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 配置项 ```
23 lines
794 B
Modula-2
23 lines
794 B
Modula-2
module dot
|
|
|
|
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
|
|
github.com/prometheus/client_model v0.6.2 // indirect
|
|
github.com/prometheus/common v0.66.1 // indirect
|
|
github.com/prometheus/procfs v0.16.1 // indirect
|
|
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
|
golang.org/x/mod v0.24.0 // indirect
|
|
golang.org/x/net v0.43.0 // indirect
|
|
golang.org/x/sync v0.14.0 // indirect
|
|
golang.org/x/sys v0.35.0 // indirect
|
|
golang.org/x/tools v0.33.0 // indirect
|
|
google.golang.org/protobuf v1.36.8 // indirect
|
|
)
|