diff --git a/pkg/serverconfigs/http_cache_policy.go b/pkg/serverconfigs/http_cache_policy.go index 6454d82..7b87ac1 100644 --- a/pkg/serverconfigs/http_cache_policy.go +++ b/pkg/serverconfigs/http_cache_policy.go @@ -96,7 +96,7 @@ func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir) { return } - var options = &HTTPFileCacheStorage{} + var options = NewHTTPFileCacheStorage() err = json.Unmarshal(oldOptionsJSON, options) if err != nil { return diff --git a/pkg/serverconfigs/http_cache_storage_file.go b/pkg/serverconfigs/http_cache_storage_file.go index f5837a5..4e57f71 100644 --- a/pkg/serverconfigs/http_cache_storage_file.go +++ b/pkg/serverconfigs/http_cache_storage_file.go @@ -16,6 +16,14 @@ type HTTPFileCacheStorage struct { OpenFileCache *OpenFileCacheConfig `yaml:"openFileCache" json:"openFileCache"` // open file cache配置 EnableSendfile bool `yaml:"enableSendFile" json:"enableSendfile"` // 是否启用Sendfile + + EnableMMAP bool `yaml:"enableMMAP" json:"enableMMAP"` // 是否启用MMAP +} + +func NewHTTPFileCacheStorage() *HTTPFileCacheStorage { + return &HTTPFileCacheStorage{ + EnableMMAP: true, + } } func (this *HTTPFileCacheStorage) Init() error {