From 5478e6a956dbd5363202c138be65b7f2a4944d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 29 Mar 2024 18:31:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8MMAP=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E8=AF=BB=E5=8F=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/serverconfigs/http_cache_policy.go | 2 +- pkg/serverconfigs/http_cache_storage_file.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 {