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

- old
+ new

@@ -14,15 +14,21 @@ def get @client.get_cas(@key) end - def set(newval, cas) - @client.set_cas(@key, newval, cas) + def set(newval, cas, expire: false) + if expire + @client.set_cas(@key, newval, cas, @options[:ttl]) + else + @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 end end end end