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.
712 713 714 715 716 |
# File 'lib/redis.rb', line 712 def setnx(key, value) synchronize do |client| client.call([:setnx, key, value.to_s], &_boolify) end end |