Check backend setup
Hi, I am currently trying to integrate Redis cache to my application, while I am not quite sure about the setting up of Redis cache using cashews. For example, after I started a Redis server at terminal I got
redis-cli 127.0.0.1:6379> ping PONG
I wonder what is the correct format of the cache.setup using cashews.cache.
Any feedback will be greatly appreciated.
Hi.
While I try to find answer for your question I found that there is no clear way to check setup of cache. Here some option to do it and in future I will add more simpler way First option that may help is also a PING method, it should fail if you use unsafe mode with cache :
import asyncio
from cashews import cache
cache.setup("redis://", safe=False)
print(asyncio.run(cache.ping(b"test")))
Even with safe mode you can check a returning of a ping method , it should be the same as you pass to it ( but do not use PONG - it is a bug)
import asyncio
from cashews import cache
cache.setup("redis://")
print(asyncio.run(cache.ping(b"message")) == b"message")
# False
Thank you a lot for your suggestion.