class Redis
def set(key, value, options = {})
-
(String, Boolean)
- `"OK"` or true, false if `:nx => true` or `:xx => true`
Parameters:
-
options
(Hash
) -- -
value
(String
) -- -
key
(String
) --
def set(key, value, options = {}) args = [] ex = options[:ex] args.concat(["EX", ex]) if ex px = options[:px] args.concat(["PX", px]) if px nx = options[:nx] args.concat(["NX"]) if nx xx = options[:xx] args.concat(["XX"]) if xx synchronize do |client| if nx || xx client.call([:set, key, value.to_s] + args, &BoolifySet) else client.call([:set, key, value.to_s] + args) end end end