Permalink
Browse files

slight optimization to hmset, mset, and msetnx for both clarity and s…

…peed
  • Loading branch information...
andymccurdy committed Aug 19, 2010
1 parent 91c0e61 commit 16c0eff87e7762d82fdd37d9949e33a7376d5357
Showing with 6 additions and 3 deletions.
  1. +6 −3 redis/client.py
View
@@ -587,7 +587,8 @@ def mget(self, keys, *args):
def mset(self, mapping):
"Sets each key in the ``mapping`` dict to its corresponding value"
items = []
[items.extend(pair) for pair in mapping.iteritems()]
for pair in mapping.iteritems():
items.extend(pair)
return self.execute_command('MSET', *items)
def msetnx(self, mapping):
@@ -596,7 +597,8 @@ def msetnx(self, mapping):
none of the keys are already set
"""
items = []
[items.extend(pair) for pair in mapping.iteritems()]
for pair in mapping.iteritems():
items.extend(pair)
return self.execute_command('MSETNX', *items)
def move(self, name, db):
@@ -1144,7 +1146,8 @@ def hmset(self, name, mapping):
in the hash ``name``
"""
items = []
[items.extend(pair) for pair in mapping.iteritems()]
for pair in mapping.iteritems():
items.extend(pair)
return self.execute_command('HMSET', name, *items)
def hmget(self, name, keys):

0 comments on commit 16c0eff

Please sign in to comment.