mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:40:25 +08:00
增加stale cache配置
This commit is contained in:
@@ -16,6 +16,8 @@ type HTTPCacheConfig struct {
|
||||
PurgeIsOn bool `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
|
||||
PurgeKey string `yaml:"purgeKey" json:"purgeKey"` // Purge时使用的X-Edge-Purge-Key
|
||||
|
||||
Stale *HTTPCacheStaleConfig `yaml:"stale" json:"stale"` // 陈旧缓存使用策略
|
||||
|
||||
CacheRefs []*HTTPCacheRef `yaml:"cacheRefs" json:"cacheRefs"` // 缓存配置
|
||||
}
|
||||
|
||||
|
||||
15
pkg/serverconfigs/http_cache_stale_config.go
Normal file
15
pkg/serverconfigs/http_cache_stale_config.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
|
||||
// HTTPCacheStaleConfig Stale策略配置
|
||||
type HTTPCacheStaleConfig struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||
|
||||
Status []int `yaml:"status" json:"status"` // 状态列表
|
||||
SupportStaleIfErrorHeader bool `yaml:"supportStaleIfErrorHeader" json:"supportStaleIfErrorHeader"` // 是否支持stale-if-error
|
||||
Life *shared.TimeDuration `yaml:"life" json:"life"` // 陈旧内容生命周期
|
||||
}
|
||||
Reference in New Issue
Block a user