MCPcopy
hub / github.com/redis/redis-py / shutdown

Method shutdown

redis/commands/core.py:2083–2123  ·  view source on GitHub ↗

Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. It is possible to specify modifiers to alter the behavior of the command: ``save`` will force a DB saving operation even if no save points are configured. ``nosave``

(
        self,
        save: bool = False,
        nosave: bool = False,
        now: bool = False,
        force: bool = False,
        abort: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

2081 return self.execute_command("SAVE", **kwargs)
2082
2083 def shutdown(
2084 self,
2085 save: bool = False,
2086 nosave: bool = False,
2087 now: bool = False,
2088 force: bool = False,
2089 abort: bool = False,
2090 **kwargs,
2091 ) -> None:
2092 """Shutdown the Redis server. If Redis has persistence configured,
2093 data will be flushed before shutdown.
2094 It is possible to specify modifiers to alter the behavior of the command:
2095 ``save`` will force a DB saving operation even if no save points are configured.
2096 ``nosave`` will prevent a DB saving operation even if one or more save points
2097 are configured.
2098 ``now`` skips waiting for lagging replicas, i.e. it bypasses the first step in
2099 the shutdown sequence.
2100 ``force`` ignores any errors that would normally prevent the server from exiting
2101 ``abort`` cancels an ongoing shutdown and cannot be combined with other flags.
2102
2103 For more information, see https://redis.io/commands/shutdown
2104 """
2105 if save and nosave:
2106 raise DataError("SHUTDOWN save and nosave cannot both be set")
2107 args = ["SHUTDOWN"]
2108 if save:
2109 args.append("SAVE")
2110 if nosave:
2111 args.append("NOSAVE")
2112 if now:
2113 args.append("NOW")
2114 if force:
2115 args.append("FORCE")
2116 if abort:
2117 args.append("ABORT")
2118 try:
2119 self.execute_command(*args, **kwargs)
2120 except ConnectionError:
2121 # a ConnectionError here is expected
2122 return
2123 raise RedisError("SHUTDOWN seems to have failed.")
2124
2125 @overload
2126 def slaveof(

Callers 5

disconnectMethod · 0.45
_connectMethod · 0.45
_wrap_socket_with_sslMethod · 0.45
_connectMethod · 0.45
resetMethod · 0.45

Calls 4

DataErrorClass · 0.90
RedisErrorClass · 0.90
appendMethod · 0.45
execute_commandMethod · 0.45

Tested by

no test coverage detected