增加stale cache配置

This commit is contained in:
刘祥超
2021-12-16 17:28:02 +08:00
parent 9171242c37
commit 73d049b380
2 changed files with 17 additions and 0 deletions

View File

@@ -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"` // 缓存配置
}

View 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"` // 陈旧内容生命周期
}