diff --git a/internal/web/actions/default/servers/components/cache/createPopup.go b/internal/web/actions/default/servers/components/cache/createPopup.go index d451be55..07c8f23a 100644 --- a/internal/web/actions/default/servers/components/cache/createPopup.go +++ b/internal/web/actions/default/servers/components/cache/createPopup.go @@ -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("请选择正确的缓存类型") } diff --git a/internal/web/actions/default/servers/components/cache/update.go b/internal/web/actions/default/servers/components/cache/update.go index 0de9d202..540a6ebd 100644 --- a/internal/web/actions/default/servers/components/cache/update.go +++ b/internal/web/actions/default/servers/components/cache/update.go @@ -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("请选择正确的缓存类型") } diff --git a/web/views/@default/servers/components/cache/createPopup.html b/web/views/@default/servers/components/cache/createPopup.html index b5437478..5c930fb3 100644 --- a/web/views/@default/servers/components/cache/createPopup.html +++ b/web/views/@default/servers/components/cache/createPopup.html @@ -26,7 +26,7 @@
作为二级缓存的文件目录允许缓存的最大容量,如果为0表示没有限制。
@@ -38,6 +38,13 @@作为一级缓存的内存最大容量,如果为0表示不使用内存作为一级缓存。
保持缓存文件句柄,提升缓存文件打开速度,建议数量是缓存文件数量的10%。
+作为一级缓存的内存最大容量,如果为0表示不使用内存作为一级缓存。
+作为一级缓存的内存最大容量,如果为0表示不使用内存作为一级缓存。
+ +保持缓存文件句柄,提升缓存文件打开速度,建议数量是缓存文件数量的10%。
+