0.0.2
All checks were successful
deploy / deploy (push) Successful in 1m21s

This commit is contained in:
2023-11-26 14:54:07 +03:00
parent 6e6de3818b
commit f4d4fd26d4
5 changed files with 25 additions and 23 deletions

View File

@@ -1,3 +1,5 @@
import asyncio
import redis.asyncio as aredis
from settings import REDIS_URL
@@ -55,6 +57,16 @@ class RedisCache:
print(f"[redis] MGET {key} {keys}")
return await self._client.mget(key, *keys)
async def listen(self, channel):
pubsub = self._client.pubsub()
pubsub.subscribe(channel)
while True:
message = pubsub.get_message()
if message:
yield message
await asyncio.sleep(0.1)
redis = RedisCache()