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
|
||||
cache_key = f"queryallrecordsbydatewithtype_{querydate}_{querytype}"
|
||||
data = redis_client.get(cache_key)
|
||||
results = []
|
||||
if data:
|
||||
# 使用自定义的反序列化函数
|
||||
loaded_dict = msgpack.unpackb(data, object_hook=object_hook)
|
||||
return loaded_dict
|
||||
|
||||
results = msgpack.unpackb(data, object_hook=object_hook)
|
||||
else:
|
||||
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)
|
||||
redis_client.set(cache_key, packed)
|
||||
|
||||
Reference in New Issue
Block a user