cleanup(config): remove dead ProxyCachePathConfig and CachePath field
Disk cache implementation was previously removed but config structs remained. Remove ProxyCachePathConfig, Config.CachePath field, e2e WithCachePath helper, and docs reference.
This commit is contained in:
parent
38bb743781
commit
d9a7ab9cca
@ -58,8 +58,7 @@ http3: {} # HTTP/3 配置
|
||||
resolver: {} # DNS 解析配置
|
||||
performance: {} # 性能配置
|
||||
shutdown: {} # 关闭配置
|
||||
include: [] # 配置引入
|
||||
cache_path: {} # 缓存路径配置
|
||||
include: [] # 配置引入
|
||||
```
|
||||
|
||||
### 运行模式
|
||||
|
||||
@ -2,54 +2,6 @@ package config
|
||||
|
||||
import "time"
|
||||
|
||||
// ProxyCachePathConfig 缓存路径配置(磁盘持久化)。
|
||||
//
|
||||
// 配置磁盘缓存路径和相关参数,支持 L1/L2 分层缓存架构。
|
||||
// 配置后,代理缓存将持久化到磁盘,服务重启后可恢复。
|
||||
//
|
||||
// 注意事项:
|
||||
// - Path 为必填项,指定缓存根目录
|
||||
// - Levels 支持最多 3 级目录(如 "1:2:2")
|
||||
// - MaxSize 为 0 表示不限制大小
|
||||
// - L1MaxEntries/L1MaxSize 为 0 时使用默认值
|
||||
//
|
||||
// 使用示例:
|
||||
//
|
||||
// cache_path:
|
||||
// path: "/var/cache/lolly"
|
||||
// levels: "1:2"
|
||||
// max_size: "1GB"
|
||||
// inactive: "60m"
|
||||
// l1_max_entries: 10000
|
||||
type ProxyCachePathConfig struct {
|
||||
// Path 缓存根目录
|
||||
Path string `yaml:"path"`
|
||||
|
||||
// Levels 目录层级,如 "1:2" 表示两级目录
|
||||
Levels string `yaml:"levels"`
|
||||
|
||||
// MaxSize 最大缓存大小(字节)
|
||||
MaxSize int64 `yaml:"max_size"`
|
||||
|
||||
// Inactive 未访问淘汰时间
|
||||
Inactive time.Duration `yaml:"inactive"`
|
||||
|
||||
// Purger 是否启用后台清理
|
||||
Purger bool `yaml:"purger"`
|
||||
|
||||
// PurgerInterval 清理间隔
|
||||
PurgerInterval time.Duration `yaml:"purger_interval"`
|
||||
|
||||
// L1MaxEntries L1 最大条目数
|
||||
L1MaxEntries int64 `yaml:"l1_max_entries"`
|
||||
|
||||
// L1MaxSize L1 最大内存大小
|
||||
L1MaxSize int64 `yaml:"l1_max_size"`
|
||||
|
||||
// PromoteThreshold 提升到 L1 的访问阈值
|
||||
PromoteThreshold int `yaml:"promote_threshold"`
|
||||
}
|
||||
|
||||
// ProxyCacheConfig 代理缓存配置。
|
||||
//
|
||||
// 缓存后端响应,减少重复请求,提高响应速度。
|
||||
|
||||
@ -81,8 +81,7 @@ type Config struct {
|
||||
Resolver ResolverConfig `yaml:"resolver"`
|
||||
Performance PerformanceConfig `yaml:"performance"`
|
||||
Shutdown ShutdownConfig `yaml:"shutdown"`
|
||||
Include []IncludeConfig `yaml:"include"` // 配置引入,支持从其他文件引入配置片段
|
||||
CachePath *ProxyCachePathConfig `yaml:"cache_path"` // 缓存路径配置(磁盘持久化)
|
||||
Include []IncludeConfig `yaml:"include"` // 配置引入,支持从其他文件引入配置片段
|
||||
}
|
||||
|
||||
// parseSize 解析大小字符串(支持 k, m 单位)。
|
||||
|
||||
@ -462,15 +462,6 @@ func (b *ConfigBuilder) WithRewrite(pattern, replacement string, opts ...Rewrite
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCachePath 配置缓存路径。
|
||||
func (b *ConfigBuilder) WithCachePath(path string, maxSize int64) *ConfigBuilder {
|
||||
b.cfg.CachePath = &config.ProxyCachePathConfig{
|
||||
Path: path,
|
||||
MaxSize: maxSize,
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResolver 配置 DNS 解析器。
|
||||
func (b *ConfigBuilder) WithResolver(addresses []string, valid, timeout time.Duration) *ConfigBuilder {
|
||||
b.cfg.Resolver = config.ResolverConfig{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user