34 lines
1.5 KiB
Markdown
34 lines
1.5 KiB
Markdown
---
|
||
title: "Trading-Lifecycle Driven Eviction (交易生命周期驱动淘汰)"
|
||
created: 2026-05-29
|
||
updated: 2026-05-29
|
||
type: concept
|
||
tags: ["distributed-systems", "caching", "ttl", "quant-trading"]
|
||
sources: ["https://mp.weixin.qq.com/s/MUWV7eug14bktUMlqsxfQw"]
|
||
---
|
||
|
||
# Trading-Lifecycle Driven Eviction (交易生命周期驱动淘汰)
|
||
|
||
**Trading-Lifecycle Driven Eviction** 是 [[distributed-prompt-caching]] 中针对量化交易场景的缓存 TTL 策略:缓存的过期时间不按固定时长设置,而是与交易的生命周期对齐。
|
||
|
||
## 两类上下文的差异化 TTL
|
||
|
||
### 因子分析级上下文
|
||
- **策略**:严格短时间滑动过期窗口(Rolling TTL)
|
||
- **逻辑**:若特定时间内无高频信号再次命中该因子前缀 → Redis 路由记录与本地实例引用同步解除
|
||
- **原因**:因子分析具有高度时效性,过期因子上下文无保留价值
|
||
|
||
### 日内持仓级上下文
|
||
- **策略**:生命周期直接与收盘时间对齐
|
||
- **逻辑**:盘后清算完成瞬间 → 集群广播指令 → 全面销毁所有日内会话的物理缓存
|
||
- **原因**:日内交易结束后,相关上下文完全失去意义
|
||
|
||
## 设计考量
|
||
|
||
考虑到 LLM 供应商的物理缓存资源有限且昂贵(部分按缓存驻留时间收费),精确的 TTL 策略不仅是工程需要,也是成本控制手段。
|
||
|
||
## 相关
|
||
|
||
- [[distributed-prompt-caching]] — 分布式缓存体系
|
||
- [[distributed-agent-cache-sync-2026]] — 原始文章
|