Skip to content
Browse files

Make rpop and lpop into their own methods.

  • Loading branch information...
1 parent cd26148 commit 72facec8c43b9d6165020550781361a681eb4a64 @rlotun committed
Showing with 9 additions and 2 deletions.
  1. +9 −2 txredis/protocol.py
View
11 txredis/protocol.py
@@ -795,6 +795,14 @@ def lindex(self, key, index):
self._send('LINDEX', key, index)
return self.getResponse()
+ def rpop(self, key):
+ self._send('RPOP', key)
+ return self.getResponse()
+
+ def lpop(self, key):
+ self._send('LPOP', key)
+ return self.getResponse()
+
def pop(self, key, tail=False):
"""
@param key Redis key
@@ -806,8 +814,7 @@ def pop(self, key, tail=False):
If the key does not exist or the list is already empty the special
value 'nil' is returned.
"""
- self._send('RPOP' if tail else 'LPOP', key)
- return self.getResponse()
+ return self.rpop(key) if tail else self.lpop(key)
def brpop(self, keys, timeout=30):
"""

0 comments on commit 72facec

Please sign in to comment.
Something went wrong with that request. Please try again.