使用MMAP提升缓存读取性能

This commit is contained in:
GoEdgeLab
2024-03-29 18:31:53 +08:00
parent a1567a79a2
commit 69f34d43dc
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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 {