update-redis-api
Some checks failed
Deploy to core / deploy (push) Failing after 1m27s

This commit is contained in:
2024-02-21 16:06:24 +03:00
parent 33330fb052
commit 63f5a708b7
7 changed files with 147 additions and 83 deletions

View File

@@ -21,6 +21,10 @@ class RedisCache:
if self._client:
try:
logger.debug(f"{command} {args} {kwargs}")
for arg in args:
if isinstance(arg, dict):
if arg.get('_sa_instance_state'):
del arg['_sa_instance_state']
r = await self._client.execute_command(command, *args, **kwargs)
logger.debug(type(r))
logger.debug(r)
@@ -48,6 +52,13 @@ class RedisCache:
return
await self._client.publish(channel, data)
async def hset(self, hash_key: str, fields_values: dict):
return await self._client.hset(hash_key, mapping=fields_values)
async def hget(self, hash_key: str):
return await self._client.hget(hash_key)
redis = RedisCache()