feat: optimize code
This commit is contained in:
@@ -71,7 +71,8 @@ async def get_redis_cache(key: str, default_value_getter):
|
||||
async with redis_utils.get_redis_connection() as redis_client:
|
||||
# default_value_getter返回的字段可能嵌套多层对象,这里改成用json字符串缓存
|
||||
json_string = await redis_client.get(key)
|
||||
exists = bool(json_string)
|
||||
exists = False if json_string == "{}" else bool(json_string)
|
||||
# print("exists", exists)
|
||||
if exists:
|
||||
return json.loads(json_string)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user