mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-12 19:30:25 +08:00
增加PURGE某个URL缓存功能
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
package serverconfigs
|
package serverconfigs
|
||||||
|
|
||||||
import "encoding/json"
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/iwind/TeaGo/rands"
|
||||||
|
)
|
||||||
|
|
||||||
type HTTPCacheConfig struct {
|
type HTTPCacheConfig struct {
|
||||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||||
|
|
||||||
AddStatusHeader bool `yaml:"addStatusHeader" json:"addStatusHeader"` // 是否增加命中状态Header
|
AddStatusHeader bool `yaml:"addStatusHeader" json:"addStatusHeader"` // 是否增加命中状态Header
|
||||||
|
PurgeIsOn bool `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
|
||||||
|
PurgeKey string `yaml:"purgeKey" json:"purgeKey"` // Purge时使用的Edge-Purge-Key
|
||||||
|
|
||||||
CacheRefs []*HTTPCacheRef `yaml:"cacheRefs" json:"cacheRefs"` // 缓存配置
|
CacheRefs []*HTTPCacheRef `yaml:"cacheRefs" json:"cacheRefs"` // 缓存配置
|
||||||
}
|
}
|
||||||
@@ -18,6 +23,11 @@ func (this *HTTPCacheConfig) Init() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if this.PurgeIsOn && len(this.PurgeKey) == 0 {
|
||||||
|
this.PurgeKey = rands.HexString(32)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user