Refine
This commit is contained in:
7
main.py
7
main.py
@@ -2362,8 +2362,11 @@ async def fastapi_query_all_records_by_date(querydate: str) -> dict:
|
||||
# 缓存查询结果提高性能
|
||||
global redis_client
|
||||
|
||||
is_today_or_future = time_api.is_today_or_future(querydate)
|
||||
logger.info(f"isToday or future: {is_today_or_future}")
|
||||
|
||||
# 今天的不要去缓存
|
||||
if not time_api.is_today_or_future(querydate):
|
||||
if not is_today_or_future:
|
||||
cache_key = f"queryallrecordsbydate_{querydate}"
|
||||
logger.info(f"cache_key: {cache_key}")
|
||||
|
||||
@@ -2381,7 +2384,7 @@ async def fastapi_query_all_records_by_date(querydate: str) -> dict:
|
||||
"links": nodes_links[1] }
|
||||
|
||||
# 今天的不要去缓存
|
||||
if not time_api.is_today_or_future(querydate):
|
||||
if not is_today_or_future:
|
||||
logger.info(f"save to cache redis")
|
||||
redis_client.set(cache_key, msgpack.packb(results, default=encode_datetime))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user