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

Method register_connect_callback

redis/connection.py:969–979  ·  view source on GitHub ↗

Register a callback to be called when the connection is established either initially or reconnected. This allows listeners to issue commands that are ephemeral to the connection, for example pub/sub subscription or key tracking. The callback must be a _method_ and

(self, callback)

Source from the content-addressed store, hash-verified

967 return PythonRespSerializer(self._buffer_cutoff, self.encoder.encode)
968
969 def register_connect_callback(self, callback):
970 """
971 Register a callback to be called when the connection is established either
972 initially or reconnected. This allows listeners to issue commands that
973 are ephemeral to the connection, for example pub/sub subscription or
974 key tracking. The callback must be a _method_ and will be kept as
975 a weak reference.
976 """
977 wm = weakref.WeakMethod(callback)
978 if wm not in self._connect_callbacks:
979 self._connect_callbacks.append(wm)
980
981 def deregister_connect_callback(self, callback):
982 """

Callers 3

execute_commandMethod · 0.45
execute_commandMethod · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected