Refine
This commit is contained in:
6
main.py
6
main.py
@@ -2172,11 +2172,11 @@ async def fastapi_query_all_records_by_ids_date_type(ids:str, querydate: str, qu
|
|||||||
global redis_client
|
global redis_client
|
||||||
cache_key = f"queryallrecordsbydatewithtype_{querydate}_{querytype}"
|
cache_key = f"queryallrecordsbydatewithtype_{querydate}_{querytype}"
|
||||||
data = redis_client.get(cache_key)
|
data = redis_client.get(cache_key)
|
||||||
|
results = []
|
||||||
if data:
|
if data:
|
||||||
# 使用自定义的反序列化函数
|
# 使用自定义的反序列化函数
|
||||||
loaded_dict = msgpack.unpackb(data, object_hook=object_hook)
|
results = msgpack.unpackb(data, object_hook=object_hook)
|
||||||
return loaded_dict
|
else:
|
||||||
|
|
||||||
results = influxdb_api.query_all_records_by_date_with_type(query_date=querydate, query_type=querytype, client=influx_client)
|
results = influxdb_api.query_all_records_by_date_with_type(query_date=querydate, query_type=querytype, client=influx_client)
|
||||||
packed = msgpack.packb(results, default=default_encoder)
|
packed = msgpack.packb(results, default=default_encoder)
|
||||||
redis_client.set(cache_key, packed)
|
redis_client.set(cache_key, packed)
|
||||||
|
|||||||
Reference in New Issue
Block a user