lib/asynchronic/data_store/redis.rb in asynchronic-3.0.0 vs lib/asynchronic/data_store/redis.rb in asynchronic-3.0.1

- old
+ new

@@ -10,40 +10,40 @@ @scope = Key[scope] @redis = Redic.new(*args) end def [](key) - value = @redis.call 'GET', @scope[key] + value = @redis.call! 'GET', @scope[key] value ? Marshal.load(value) : nil rescue => ex Asynchronic.logger.warn('Asynchronic') { ex.message } value end def []=(key, value) - @redis.call 'SET', @scope[key], Marshal.dump(value) + @redis.call! 'SET', @scope[key], Marshal.dump(value) end def delete(key) - @redis.call 'DEL', @scope[key] + @redis.call! 'DEL', @scope[key] end def delete_cascade(key) - @redis.call 'DEL', @scope[key] - @redis.call('KEYS', @scope[key]['*']).each { |k| @redis.call 'DEL', k } + @redis.call! 'DEL', @scope[key] + @redis.call!('KEYS', @scope[key]['*']).each { |k| @redis.call! 'DEL', k } end def keys - @redis.call('KEYS', @scope['*']).map { |k| Key[k].remove_first } + @redis.call!('KEYS', @scope['*']).map { |k| Key[k].remove_first } end def synchronize(key) - while @redis.call('GETSET', @scope[key][LOCKED], LOCKED) == LOCKED + while @redis.call!('GETSET', @scope[key][LOCKED], LOCKED) == LOCKED sleep Asynchronic.redis_data_store_sync_timeout end yield ensure - @redis.call 'DEL', @scope[key][LOCKED] + @redis.call! 'DEL', @scope[key][LOCKED] end def connection_args [@scope, @redis.url] end \ No newline at end of file