Skip to content

Commit

Permalink
Updated setex in StrictRedis to be compliant with Redis's argument si…
Browse files Browse the repository at this point in the history
…gnature. Older version to Redis subclass.
  • Loading branch information
andymccurdy committed Aug 1, 2011
1 parent 3265af8 commit e2b66fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions redis/client.py
Expand Up @@ -474,7 +474,7 @@ def setbit(self, name, offset, value):
value = value and 1 or 0
return self.execute_command('SETBIT', name, offset, value)

def setex(self, name, value, time):
def setex(self, name, time, value):
"""
Set the value of key ``name`` to ``value``
that expires in ``time`` seconds
Expand Down Expand Up @@ -1070,10 +1070,17 @@ def publish(self, channel, message):
class Redis(StrictRedis):
"""
Provides backwards compatibility with older versions of redis-py that
changed arguemnts to some commands to be more Pythonic, sane, or
changed arguments to some commands to be more Pythonic, sane, or by
accident.
"""

def setex(self, name, value, time):
"""
Set the value of key ``name`` to ``value``
that expires in ``time`` seconds
"""
return self.execute_command('SETEX', name, time, value)

def lrem(self, name, value, num=0):
"""
Remove the first ``num`` occurrences of elements equal to ``value``
Expand Down

0 comments on commit e2b66fd

Please sign in to comment.