summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2018-11-03 18:22:15 -0700
committerGitHub <noreply@github.com>2018-11-03 18:22:15 -0700
commit53a9f6b048de885bb672abaa4a4a019e1849cc13 (patch)
tree872b9f34f457939c7577e7c97105a1968f5a375e
parent350362405112d6047ade4c3cc81931a2b4e33e36 (diff)
parente0032fc62634926ff17127e73327b03162f1d2f8 (diff)
downloadredis-py-53a9f6b048de885bb672abaa4a4a019e1849cc13.tar.gz
Merge pull request #1051 from itamarhaber/swapdb
Adds SWAPDB
-rwxr-xr-xredis/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index f4f7489..a597d3a 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -440,7 +440,7 @@ class StrictRedis(object):
string_keys_to_dict('ZSCORE ZINCRBY GEODIST', float_or_none),
string_keys_to_dict(
'FLUSHALL FLUSHDB LSET LTRIM MSET PFMERGE RENAME '
- 'SAVE SELECT SHUTDOWN SLAVEOF WATCH UNWATCH',
+ 'SAVE SELECT SHUTDOWN SLAVEOF SWAPDB WATCH UNWATCH',
bool_ok
),
string_keys_to_dict('BLPOP BRPOP', lambda r: r and tuple(r) or None),
@@ -826,6 +826,10 @@ class StrictRedis(object):
"Delete all keys in the current database"
return self.execute_command('FLUSHDB')
+ def swapdb(self, first, second):
+ "Swap two databases"
+ return self.execute_command('SWAPDB', first, second)
+
def info(self, section=None):
"""
Returns a dictionary containing information about the Redis server