Replies: 2 comments 1 reply
-
Maybe the following middleware I have is also of interest here: async def cache_logging_middleware(
call, *args, backend=None, cmd=None, **kwargs):
key = args[0] if args else kwargs.get("key", kwargs.get("pattern", ""))
logging.info("Redis cache request: %s %s", cmd, key,
extra={"command": cmd, "cache_key": key})
return await call(*args, **kwargs)
...
# Initialization here:
from cashews import cache
cache.setup(f"redis://{cfg.redis.endpoint}:{cfg.redis.port}/0",
middlewares=(
cache_logging_middleware,
),
password=redis_password,
retry_on_timeout=True,
prefix=REDIS_REDLOCK_NAMESPACE) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Isn't it the change middleware interface, thus, correct in this way? async def cache_logging_middleware(
call, cmd: Command, backend: Backend, *args, **kwargs):
key = args[0] if args else kwargs.get("key", kwargs.get("pattern", ""))
logging.info("Redis cache request: %s", cmd.value,
extra={"command": cmd, "cache_key": key})
return await call(*args, **kwargs) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I got some difficulties after migrating cashews from 4.1.0 to 5.0.0.
In the following code:
I get the following error in cashews 5.0.0, but not in 4.1.0:
Below there are the relevant changes from the commit that caused this:
Is there anyone able to help what's wrong here with my code?
Unfortunately I haven't found any Changelog pointing out the relevant breaking changes.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions