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

Method _on_invalidation_callback

redis/connection.py:1982–1994  ·  view source on GitHub ↗
(self, data: List[Union[str, Optional[List[bytes]]]])

Source from the content-addressed store, hash-verified

1980 break
1981
1982 def _on_invalidation_callback(self, data: List[Union[str, Optional[List[bytes]]]]):
1983 with self._cache_lock:
1984 # Flush cache when DB flushed on server-side
1985 if data[1] is None:
1986 self._cache.flush()
1987 else:
1988 keys_deleted = self._cache.delete_by_redis_keys(data[1])
1989
1990 if len(keys_deleted) > 0:
1991 record_csc_eviction(
1992 count=len(keys_deleted),
1993 reason=CSCReason.INVALIDATION,
1994 )
1995
1996 def extract_connection_details(self) -> str:
1997 return self._conn.extract_connection_details()

Callers

nothing calls this directly

Calls 3

record_csc_evictionFunction · 0.85
flushMethod · 0.45
delete_by_redis_keysMethod · 0.45

Tested by

no test coverage detected