This commit is contained in:
@@ -10,33 +10,33 @@ from services.rediscache import redis
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
def get_all_authors():
|
||||
async def get_all_authors():
|
||||
authors = []
|
||||
redis_key = "user:*"
|
||||
|
||||
result = redis.execute("GET", redis_key)
|
||||
result = await redis.execute("GET", redis_key)
|
||||
if isinstance(result, str):
|
||||
authors = json.loads(result)
|
||||
|
||||
return authors
|
||||
|
||||
|
||||
def get_author_by_user(user: str):
|
||||
async def get_author_by_user(user: str):
|
||||
author = None
|
||||
redis_key = f"user:{user}"
|
||||
|
||||
result = redis.execute("GET", redis_key)
|
||||
result = await redis.execute("GET", redis_key)
|
||||
if isinstance(result, str):
|
||||
author = json.loads(result)
|
||||
|
||||
return author
|
||||
|
||||
|
||||
def get_author_followed(author_id: int):
|
||||
async def get_author_followed(author_id: int):
|
||||
authors = []
|
||||
redis_key = f"author:{author_id}:follows-authors"
|
||||
|
||||
result = redis.execute("GET", redis_key)
|
||||
result = await redis.execute("GET", redis_key)
|
||||
if isinstance(result, str):
|
||||
authors = json.loads(result)
|
||||
|
||||
|
Reference in New Issue
Block a user