From 3712ecf8ae41c4e93d0ba103074bd88fb46661db Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 May 2024 18:07:41 +0300 Subject: [PATCH] author:user-key --- services/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cache.py b/services/cache.py index a33bc2c4..c8140ce0 100644 --- a/services/cache.py +++ b/services/cache.py @@ -28,7 +28,7 @@ async def cache_author(author: dict): author_id = author.get("id") user_id = author.get("user") payload = json.dumps(author, cls=CustomJSONEncoder) - await redis.execute("SET", f"user:id:{user_id}", author_id) + await redis.execute("SET", f"author:user:{user_id}", author_id) await redis.execute("SET", f"author:id:{author_id}", payload) @@ -74,7 +74,7 @@ async def get_cached_author(author_id: int, get_with_stat): async def get_cached_author_by_user_id(user_id: str, get_with_stat): - author_id = await redis.execute("GET", f"user:id:{user_id}") + author_id = await redis.execute("GET", f"author:user:{user_id}") if author_id: return await get_cached_author(int(author_id), get_with_stat)