Skip to content

Commit

Permalink
special handling for mset and msetnx so they actualy work with hash o…
Browse files Browse the repository at this point in the history
…r array args
  • Loading branch information
Ezra Zygmuntowicz committed Mar 21, 2010
1 parent 07579be commit 461689c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/redis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,24 @@ def set(key, value, expiry=nil)
expire(key, expiry) if s && expiry
s
end

def mset(*args)
hsh = args.pop if Hash === args.last
if hsh
call_command(hsh.to_a.flatten.unshift(:mset))
else
call_command(args.unshift(:mset))
end
end

def msetnx(*args)
hsh = args.pop if Hash === args.last
if hsh
call_command(hsh.to_a.flatten.unshift(:msetnx))
else
call_command(args.unshift(:msetnx))
end
end

def sort(key, options = {})
cmd = ["SORT"]
Expand Down

0 comments on commit 461689c

Please sign in to comment.