```
feat(cache): 引入 LRU 缓存并优化缓存清理与 TTL 处理 - 使用 github.com/hashicorp/golang-lru/v2 替代原生 sync.Map 实现 LRU 缓存 - 修复缓存读写过程中的并发安全问题,使用 RWMutex 保护共享状态 - 调整缓存键结构注释,明确支持 TTL 和 LRU 策略 - 优化负面缓存 TTL 计算逻辑,更准确识别 NODATA 场景 - 在缓存写入前统一剥离伪 RR(如 OPT、TSIG) - 增加 cache-size 命令行参数,支持配置 LRU 缓存最大条目数 - 移除旧的缓存清理协程中不必要的全量遍历逻辑 - 更新日志输出内容,包含 cache-size 配置项 ```
This commit is contained in:
1
go.mod
1
go.mod
@@ -5,6 +5,7 @@ go 1.25.2
|
||||
require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/miekg/dns v1.1.68 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
|
||||
Reference in New Issue
Block a user