Method: Redis#setnx
- Defined in:
- lib/redis.rb
#setnx(key, value) ⇒ Boolean
Set the value of a key, only if the key does not exist.
882 883 884 885 886 |
# File 'lib/redis.rb', line 882 def setnx(key, value) synchronize do |client| client.call([:setnx, key, value.to_s], &Boolify) end end |