redis key 精确到分钟

This commit is contained in:
zhangkun9038@dingtalk.com 2025-08-17 04:42:08 +08:00
parent fe14f21626
commit 8cef39513a

View File

@ -1228,8 +1228,10 @@ class FreqaiPrimer(IStrategy):
# 生成统一的缓存键
strategy_name = "freqaiprimer"
timeframes_str = "3m-15m-1h"
cache_key = f"{strategy_name}|trend_score|{pair.replace('/', '-')}|{timeframes_str}|{timestamp}"
logger.debug(f"[{pair}] 生成缓存键:{cache_key} (时间戳: {timestamp})")
# 将时间戳精度从秒改为分钟,去掉最后两位秒数
minute_timestamp = int(timestamp // 60) * 60 # 向下取整到分钟
cache_key = f"{strategy_name}|trend_score|{pair.replace('/', '-')}|{timeframes_str}|{minute_timestamp}"
logger.debug(f"[{pair}] 生成缓存键:{cache_key} (时间戳: {minute_timestamp})")
# 🎯 一级缓存:本地内存检查
if cache_key in self._local_cache: