mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-06 06:40:25 +08:00
只有边缘节点有自定义缓存目录时才会更新缓存策略
This commit is contained in:
@@ -84,6 +84,10 @@ func (this *HTTPCachePolicy) IsSame(anotherPolicy *HTTPCachePolicy) bool {
|
|||||||
// UpdateDiskDir 修改文件路径
|
// UpdateDiskDir 修改文件路径
|
||||||
func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir) {
|
func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir) {
|
||||||
if this.Type == CachePolicyStorageFile {
|
if this.Type == CachePolicyStorageFile {
|
||||||
|
if len(dir) == 0 && len(subDirs) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
oldOptionsJSON, err := json.Marshal(this.Options)
|
oldOptionsJSON, err := json.Marshal(this.Options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -95,8 +99,12 @@ func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(dir) > 0 {
|
||||||
options.Dir = dir
|
options.Dir = dir
|
||||||
|
}
|
||||||
|
if len(subDirs) > 0 {
|
||||||
options.SubDirs = subDirs
|
options.SubDirs = subDirs
|
||||||
|
}
|
||||||
|
|
||||||
newOptionsJSON, err := json.Marshal(options)
|
newOptionsJSON, err := json.Marshal(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user