缓存设置中可以设置缓存主域名,用来复用多域名下的缓存

This commit is contained in:
刘祥超
2023-12-13 18:41:24 +08:00
parent 4209969214
commit 9ee5c896d1
10 changed files with 1399 additions and 916 deletions

View File

@@ -14,6 +14,8 @@ type HTTPCacheConfig struct {
EnableCacheControlMaxAge bool `yaml:"enableCacheControlMaxAge" json:"enableCacheControlMaxAge"` // 是否支持Cache-Control: max-age=...
DisablePolicyRefs bool `yaml:"disablePolicyRefs" json:"disablePolicyRefs"` // 是否停用策略中定义的条件
Key *HTTPCacheKeyConfig `yaml:"key" json:"key"` // 键值全局配置
PurgeIsOn bool `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
PurgeKey string `yaml:"purgeKey" json:"purgeKey"` // Purge时使用的X-Edge-Purge-Key
@@ -30,6 +32,13 @@ func (this *HTTPCacheConfig) Init() error {
}
}
if this.Key != nil {
err := this.Key.Init()
if err != nil {
return err
}
}
if this.PurgeIsOn && len(this.PurgeKey) == 0 {
this.PurgeKey = rands.HexString(32)
}