This commit is contained in:
DingZQ
2025-03-15 17:54:06 +08:00
parent 80f1885194
commit 0de513cda4

12
main.py
View File

@@ -2172,14 +2172,14 @@ 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 = 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)
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)
query_ids = ids.split(",")
logger.info("ids", ids)