diff --git a/pkg/serverconfigs/http_cache_config.go b/pkg/serverconfigs/http_cache_config.go index 13bae02..4f761c4 100644 --- a/pkg/serverconfigs/http_cache_config.go +++ b/pkg/serverconfigs/http_cache_config.go @@ -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"` // 缓存配置 } diff --git a/pkg/serverconfigs/http_cache_stale_config.go b/pkg/serverconfigs/http_cache_stale_config.go new file mode 100644 index 0000000..504a32d --- /dev/null +++ b/pkg/serverconfigs/http_cache_stale_config.go @@ -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"` // 陈旧内容生命周期 +}