mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 12:20:28 +08:00
使用MMAP提升缓存读取性能
This commit is contained in:
@@ -41,6 +41,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
MaxSizeJSON []byte
|
||||
FetchTimeoutJSON []byte
|
||||
SyncCompressionCache bool
|
||||
EnableMMAP bool
|
||||
|
||||
Description string
|
||||
IsOn bool
|
||||
@@ -97,6 +98,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
OpenFileCache: openFileCacheConfig,
|
||||
EnableSendfile: params.FileEnableSendfile,
|
||||
MinFreeSize: minFreeSize,
|
||||
EnableMMAP: params.EnableMMAP,
|
||||
}
|
||||
case serverconfigs.CachePolicyStorageMemory:
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{}
|
||||
|
||||
@@ -40,13 +40,23 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// fix min free size
|
||||
if cachePolicy.Type == serverconfigs.CachePolicyStorageFile && cachePolicy.Options != nil {
|
||||
_, ok := cachePolicy.Options["minFreeSize"]
|
||||
if !ok {
|
||||
cachePolicy.Options["minFreeSize"] = &shared.SizeCapacity{
|
||||
Count: 0,
|
||||
Unit: shared.SizeCapacityUnitGB,
|
||||
// fix min free size
|
||||
{
|
||||
_, ok := cachePolicy.Options["minFreeSize"]
|
||||
if !ok {
|
||||
cachePolicy.Options["minFreeSize"] = &shared.SizeCapacity{
|
||||
Count: 0,
|
||||
Unit: shared.SizeCapacityUnitGB,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix enableMMAP
|
||||
{
|
||||
_, ok := cachePolicy.Options["enableMMAP"]
|
||||
if !ok {
|
||||
cachePolicy.Options["enableMMAP"] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +87,8 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
SyncCompressionCache bool
|
||||
FetchTimeoutJSON []byte
|
||||
|
||||
EnableMMAP bool
|
||||
|
||||
Description string
|
||||
IsOn bool
|
||||
|
||||
@@ -137,6 +149,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
OpenFileCache: openFileCacheConfig,
|
||||
EnableSendfile: params.FileEnableSendfile,
|
||||
MinFreeSize: minFreeSize,
|
||||
EnableMMAP: params.EnableMMAP,
|
||||
}
|
||||
case serverconfigs.CachePolicyStorageMemory:
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{}
|
||||
|
||||
Reference in New Issue
Block a user