mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
实现open file cache
This commit is contained in:
@@ -31,6 +31,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
// file
|
||||
FileDir string
|
||||
FileMemoryCapacityJSON []byte
|
||||
FileOpenFileCacheMax int
|
||||
|
||||
CapacityJSON []byte
|
||||
MaxSizeJSON []byte
|
||||
@@ -62,15 +63,23 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
var openFileCacheConfig *serverconfigs.OpenFileCacheConfig
|
||||
if params.FileOpenFileCacheMax > 0 {
|
||||
openFileCacheConfig = &serverconfigs.OpenFileCacheConfig{
|
||||
IsOn: true,
|
||||
Max: params.FileOpenFileCacheMax,
|
||||
}
|
||||
}
|
||||
|
||||
options = &serverconfigs.HTTPFileCacheStorage{
|
||||
Dir: params.FileDir,
|
||||
MemoryPolicy: &serverconfigs.HTTPCachePolicy{
|
||||
Capacity: memoryCapacity,
|
||||
},
|
||||
OpenFileCache: openFileCacheConfig,
|
||||
}
|
||||
case serverconfigs.CachePolicyStorageMemory:
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{
|
||||
}
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{}
|
||||
default:
|
||||
this.Fail("请选择正确的缓存类型")
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
// file
|
||||
FileDir string
|
||||
FileMemoryCapacityJSON []byte
|
||||
FileOpenFileCacheMax int
|
||||
|
||||
CapacityJSON []byte
|
||||
MaxSizeJSON []byte
|
||||
@@ -91,15 +92,23 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
var openFileCacheConfig *serverconfigs.OpenFileCacheConfig
|
||||
if params.FileOpenFileCacheMax > 0 {
|
||||
openFileCacheConfig = &serverconfigs.OpenFileCacheConfig{
|
||||
IsOn: true,
|
||||
Max: params.FileOpenFileCacheMax,
|
||||
}
|
||||
}
|
||||
|
||||
options = &serverconfigs.HTTPFileCacheStorage{
|
||||
Dir: params.FileDir,
|
||||
MemoryPolicy: &serverconfigs.HTTPCachePolicy{
|
||||
Capacity: memoryCapacity,
|
||||
},
|
||||
OpenFileCache: openFileCacheConfig,
|
||||
}
|
||||
case serverconfigs.CachePolicyStorageMemory:
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{
|
||||
}
|
||||
options = &serverconfigs.HTTPMemoryCacheStorage{}
|
||||
default:
|
||||
this.Fail("请选择正确的缓存类型")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user