Sha256: 2d04451c98a24906b6bc9e92ac1b9fcb7ab3c1ffb033c9f9ae3f34121d91e9b6
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
module Suo module Client class Redis < Base def initialize(options = {}) options[:client] ||= ::Redis.new(options[:connection] || {}) super end class << self def clear(key, options = {}) options = merge_defaults(options) options[:client].del(key) end private def get(key, options) [options[:client].get(key), nil] end def set(key, newval, _, options) ret = options[:client].multi do |multi| multi.set(key, newval) end ret[0] == "OK" end def synchronize(key, options) options[:client].watch(key) do yield end ensure options[:client].unwatch end def set_initial(key, options) options[:client].set(key, "") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
suo-0.1.3 | lib/suo/client/redis.rb |
suo-0.1.2 | lib/suo/client/redis.rb |