summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xredis/client.py1
-rw-r--r--redis/commands.py6
-rw-r--r--tests/test_commands.py3
3 files changed, 10 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index ef37506..a4d7f6b 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -709,6 +709,7 @@ class Redis(Commands, object):
'MODULE LIST': lambda r: [pairs_to_dict(m) for m in r],
'OBJECT': parse_object,
'PING': lambda r: str_if_bytes(r) == 'PONG',
+ 'QUIT': bool_ok,
'STRALGO': parse_stralgo,
'PUBSUB NUMSUB': parse_pubsub_numsub,
'RANDOMKEY': lambda r: r and r or None,
diff --git a/redis/commands.py b/redis/commands.py
index e1f7368..4230779 100644
--- a/redis/commands.py
+++ b/redis/commands.py
@@ -538,6 +538,12 @@ class Commands:
"Ping the Redis server"
return self.execute_command('PING')
+ def quit(self):
+ """Ask the server to close the connection.
+ https://redis.io/commands/quit
+ """
+ return self.execute_command('QUIT')
+
def save(self):
"""
Tell the Redis server to save its data to disk,
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 1a34712..d77a01c 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -478,6 +478,9 @@ class TestRedisCommands:
def test_ping(self, r):
assert r.ping()
+ def test_quit(self, r):
+ assert r.quit()
+
def test_slowlog_get(self, r, slowlog):
assert r.slowlog_reset()
unicode_string = chr(3456) + 'abcd' + chr(3421)