mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-28 07:50:25 +08:00
使用MMAP提升缓存读取性能
This commit is contained in:
@@ -96,7 +96,7 @@ func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = &HTTPFileCacheStorage{}
|
var options = NewHTTPFileCacheStorage()
|
||||||
err = json.Unmarshal(oldOptionsJSON, options)
|
err = json.Unmarshal(oldOptionsJSON, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ type HTTPFileCacheStorage struct {
|
|||||||
|
|
||||||
OpenFileCache *OpenFileCacheConfig `yaml:"openFileCache" json:"openFileCache"` // open file cache配置
|
OpenFileCache *OpenFileCacheConfig `yaml:"openFileCache" json:"openFileCache"` // open file cache配置
|
||||||
EnableSendfile bool `yaml:"enableSendFile" json:"enableSendfile"` // 是否启用Sendfile
|
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 {
|
func (this *HTTPFileCacheStorage) Init() error {
|
||||||
|
|||||||
Reference in New Issue
Block a user