diff options
author | Alireza <alirezasadeghi71@gmail.com> | 2017-10-09 11:03:35 +0330 |
---|---|---|
committer | Alireza <alirezasadeghi71@gmail.com> | 2017-10-09 11:03:35 +0330 |
commit | 3edccee4a18197da0436a6d2d33269190d07ed54 (patch) | |
tree | 9f71455da6b6db0141e7a57c000cd32c2085d75e | |
parent | 9858a090ad0c01f7fa00ba9e04a655f4f91598d6 (diff) | |
download | redis-py-3edccee4a18197da0436a6d2d33269190d07ed54.tar.gz |
Added number of members to be popped from set, by spop command
-rwxr-xr-x | redis/client.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py index e3b5ed7..79e94d0 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1642,9 +1642,10 @@ class StrictRedis(object): "Move ``value`` from set ``src`` to set ``dst`` atomically" return self.execute_command('SMOVE', src, dst, value) - def spop(self, name): + def spop(self, name, count=None): "Remove and return a random member of set ``name``" - return self.execute_command('SPOP', name) + args = (count is not None) and [count] or [] + return self.execute_command('SPOP', name, *args) def srandmember(self, name, number=None): """ |