lib/suo/client/memcached.rb in suo-0.3.3 vs lib/suo/client/memcached.rb in suo-0.3.4

- old
+ new

@@ -5,30 +5,32 @@ options[:client] ||= Dalli::Client.new(options[:connection] || ENV["MEMCACHE_SERVERS"] || "127.0.0.1:11211") super end def clear - @client.delete(@key) + @client.with { |client| client.delete(@key) } end private def get - @client.get_cas(@key) + @client.with { |client| client.get_cas(@key) } end def set(newval, cas, expire: false) if expire - @client.set_cas(@key, newval, cas, @options[:ttl]) + @client.with { |client| client.set_cas(@key, newval, cas, @options[:ttl]) } else - @client.set_cas(@key, newval, cas) + @client.with { |client| client.set_cas(@key, newval, cas) } end end def initial_set(val = BLANK_STR) - @client.set(@key, val) - _val, cas = @client.get_cas(@key) - cas + @client.with do |client| + client.set(@key, val) + _val, cas = client.get_cas(@key) + cas + end end end end end