This commit is contained in:
parent
d20647c825
commit
3712ecf8ae
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user