summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItamar Haber <itamar@redislabs.com>2018-11-03 21:12:49 +0200
committerItamar Haber <itamar@redislabs.com>2018-11-03 21:12:49 +0200
commite0032fc62634926ff17127e73327b03162f1d2f8 (patch)
treef58ec3df9ad187a0ac180cf41a9ea3653f5b4afe
parent9ecad8437ef39b75ce42bacab880cb6eb8571655 (diff)
downloadredis-py-e0032fc62634926ff17127e73327b03162f1d2f8.tar.gz
Adds SWAPDB
No tests were added - consistent with basic operations such as FLUSHDB Signed-off-by: Itamar Haber <itamar@redislabs.com>
-rwxr-xr-xredis/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 160cfb6..ae4bbd3 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -439,7 +439,7 @@ class StrictRedis(object):
string_keys_to_dict('ZSCORE ZINCRBY', 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),
@@ -817,6 +817,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