Method: Redis::Connection::Memory#msetnx
- Defined in:
- lib/redis/connection/memory.rb
#msetnx(*pairs) ⇒ Object
974 975 976 977 978 979 980 981 982 |
# File 'lib/redis/connection/memory.rb', line 974 def msetnx(*pairs) # Handle pairs for mapped_msetnx command pairs = pairs[0] if mapped_param?(pairs) keys = [] pairs.each_with_index{|item, index| keys << item.to_s if index % 2 == 0} return false if keys.any?{|key| data.key?(key) } mset(*pairs) true end |