summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
authorDaniel Williams <dwilliams@kenzan.com>2018-11-14 14:13:12 -0700
committerDaniel Williams <dwilliams@kenzan.com>2018-11-14 14:13:12 -0700
commit74d791d4b44a09ba06a16fb376b1cd08e79e39ec (patch)
tree215d77728459b0cd2609e2761a9916724a6d5736 /redis
parent137fac1a57bb7d2a5bfa60c23e960cee9eaaa57a (diff)
downloadredis-py-74d791d4b44a09ba06a16fb376b1cd08e79e39ec.tar.gz
Updating based on feedback from the pull request.
Diffstat (limited to 'redis')
-rwxr-xr-xredis/client.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/redis/client.py b/redis/client.py
index cc00de0..1afbdd5 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -822,12 +822,19 @@ class StrictRedis(object):
"Returns a list of slaves for ``service_name``"
return self.execute_command('SENTINEL SLAVES', service_name)
- def shutdown(self, save=True):
- "Shutdown the server"
+ def shutdown(self, save=False, nosave=False):
+ """Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If
+ the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the
+ "nosave" option is set, no data flush will be attempted. The "save" and "nosave" options cannot both be set.
+ """
+ if save and nosave:
+ raise RedisError('SHUTDOWN save and nosave cannot both be set')
+ args = ['SHUTDOWN']
+ if save:
+ args.append('SAVE')
+ if nosave:
+ args.append('NOSAVE')
try:
- args = ['SHUTDOWN']
- if not save:
- args.append('NOSAVE')
self.execute_command(*args)
except ConnectionError:
# a ConnectionError here is expected