lib/suo/client/redis.rb in suo-0.3.0 vs lib/suo/client/redis.rb in suo-0.3.1

- old
+ new

@@ -1,8 +1,10 @@ module Suo module Client class Redis < Base + OK_STR = "OK".freeze + def initialize(key, options = {}) options[:client] ||= ::Redis.new(options[:connection] || {}) super end @@ -19,21 +21,21 @@ def set(newval, _) ret = @client.multi do |multi| multi.set(@key, newval) end - ret && ret[0] == "OK" + ret && ret[0] == OK_STR end def synchronize @client.watch(@key) do yield end ensure @client.unwatch end - def initial_set(val = "") + def initial_set(val = BLANK_STR) @client.set(@key, val) end end end end