feat(config): 添加文件列表缓存配置并优化阿里云和S3适配器缓存实现

- 添加 CacheConfig 结构体定义文件列表缓存的TTL和最大条目数
- 在RecordConfig中集成Cache配置项
- 为AliOSS和S3适配器实现统一的文件列表缓存机制
- 移除原有的sync.Map缓存实现和定时清理逻辑
- 引入go-cache依赖库实现专业的缓存管理功能
- 使用LRU算法控制缓存大小避免内存泄漏
- 通过singleflight实现缓存穿透保护和并发控制
- 更新配置文件添加缓存相关配置项
- 在.gitignore中添加.exe文件忽略规则
This commit is contained in:
2025-12-29 11:17:18 +08:00
parent 86f0182593
commit 686401162f
8 changed files with 347 additions and 272 deletions

View File

@@ -4,9 +4,15 @@ type ApiConfig struct {
BaseUrl string `mapstructure:"baseUrl"`
}
type CacheConfig struct {
FileListTTLSeconds int `mapstructure:"fileListTTLSeconds"`
FileListMaxEntries int `mapstructure:"fileListMaxEntries"`
}
type RecordConfig struct {
Storage StorageConfig `mapstructure:"storage"`
Duration int `mapstructure:"duration"`
Cache CacheConfig `mapstructure:"cache"`
}
type StorageConfig struct {