Commit 9139ffe6 authored by Rajko Albrecht's avatar Rajko Albrecht

use correct check for existing key

parent 5688a64b
......@@ -5,10 +5,9 @@ class Redis
module Cas
def cas key, ttl=nil
watch(key) do
break false unless exists(key)
value = get(key)
break false if value.nil?
value = yield value
ires = multi do |multi|
multi.set(key,value,{:expire_in => ttl})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment