Skip to content

Commit 7ab5713

Browse files
committed
feat: support client cache with libvalkey
Signed-off-by: Anne Lee <[email protected]>
1 parent 994ed74 commit 7ab5713

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

valkey/_parsers/libvalkey.py

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self, socket_read_size):
4040
raise ValkeyError("libvalkey is not installed")
4141
self.socket_read_size = socket_read_size
4242
self._buffer = bytearray(socket_read_size)
43+
self.invalidations_push_handler_func = None
4344

4445
def __del__(self):
4546
try:
@@ -144,6 +145,9 @@ def read_response(self, disable_decoding=False):
144145
raise response[0]
145146
return response
146147

148+
def set_invalidation_push_handler(self, invalidations_push_handler_func):
149+
self.invalidations_push_handler_func = invalidations_push_handler_func
150+
147151

148152
class _AsyncLibvalkeyParser(AsyncBaseParser):
149153
"""Async implementation of parser class for connections using libvalkey"""
@@ -155,6 +159,7 @@ def __init__(self, socket_read_size: int):
155159
raise ValkeyError("libvalkey is not available.")
156160
super().__init__(socket_read_size=socket_read_size)
157161
self._reader = None
162+
self.invalidations_push_handler_func = None
158163

159164
def on_connect(self, connection):
160165
import libvalkey
@@ -228,3 +233,6 @@ async def read_response(
228233
):
229234
raise response[0]
230235
return response
236+
237+
def set_invalidation_push_handler(self, invalidations_push_handler_func):
238+
self.invalidations_push_handler_func = invalidations_push_handler_func

0 commit comments

Comments
 (0)