Open
Description
Is it possible to run a function whenever a cache is used or cache key is set? Ideally something similar to the custom_key_coder , for example:
def key_set_function(
func,
namespace: Optional[str] = "",
request: Request = None,
response: Response = None,
*args,
**kwargs,
):
// Do something
return something
@app.get("/")
@cache(expire=60, coder=JsonCoder , key_set_handler=key_set_function)
async def index(request: Request, response: Response):
return dict(hello="world")
I'm aware of aiocache having hooks which are implemented via 'plugins' that you can run before and after a new key is set. Thanks!