File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -1161,9 +1161,12 @@ async def get_message(
1161
1161
return await self .handle_message (response , ignore_subscribe_messages )
1162
1162
return None
1163
1163
1164
- def ping (self , message = None ) -> Awaitable :
1164
+ def ping (self , message = None ) -> Awaitable [ bool ] :
1165
1165
"""
1166
- Ping the Redis server
1166
+ Ping the Redis server to test connectivity.
1167
+
1168
+ Sends a PING command to the Redis server and returns True if the server
1169
+ responds with "PONG".
1167
1170
"""
1168
1171
args = ["PING" , message ] if message is not None else ["PING" ]
1169
1172
return self .execute_command (* args )
Original file line number Diff line number Diff line change @@ -1186,7 +1186,10 @@ def get_message(
1186
1186
1187
1187
def ping (self , message : Union [str , None ] = None ) -> bool :
1188
1188
"""
1189
- Ping the Redis server
1189
+ Ping the Redis server to test connectivity.
1190
+
1191
+ Sends a PING command to the Redis server and returns True if the server
1192
+ responds with "PONG".
1190
1193
"""
1191
1194
args = ["PING" , message ] if message is not None else ["PING" ]
1192
1195
return self .execute_command (* args )
Original file line number Diff line number Diff line change @@ -1210,11 +1210,18 @@ def latency_reset(self, *events: str) -> ResponseT:
1210
1210
"""
1211
1211
return self .execute_command ("LATENCY RESET" , * events )
1212
1212
1213
- def ping (self , ** kwargs ) -> ResponseT :
1213
+ def ping (self , ** kwargs ) -> Union [ Awaitable [ bool ], bool ] :
1214
1214
"""
1215
- Ping the Redis server
1215
+ Ping the Redis server to test connectivity.
1216
1216
1217
- For more information, see https://redis.io/commands/ping
1217
+ Sends a PING command to the Redis server and returns True if the server
1218
+ responds with "PONG".
1219
+
1220
+ This command is useful for:
1221
+ - Testing whether a connection is still alive
1222
+ - Verifying the server's ability to serve data
1223
+
1224
+ For more information on the underlying ping command see https://redis.io/commands/ping
1218
1225
"""
1219
1226
return self .execute_command ("PING" , ** kwargs )
1220
1227
You can’t perform that action at this time.
0 commit comments