diff --git a/pkg/serverconfigs/http_cache_storage_file.go b/pkg/serverconfigs/http_cache_storage_file.go index 227eb0b..a43c11b 100644 --- a/pkg/serverconfigs/http_cache_storage_file.go +++ b/pkg/serverconfigs/http_cache_storage_file.go @@ -1,11 +1,19 @@ package serverconfigs -// 文件缓存存储策略 +// HTTPFileCacheStorage 文件缓存存储策略 type HTTPFileCacheStorage struct { Dir string `yaml:"dir" json:"dir"` // 目录 MemoryPolicy *HTTPCachePolicy `yaml:"memoryPolicy" json:"memoryPolicy"` // 内存二级缓存 + + OpenFileCache *OpenFileCacheConfig `yaml:"openFileCache" json:"openFileCache"` // open file cache配置 } func (this *HTTPFileCacheStorage) Init() error { + if this.OpenFileCache != nil { + err := this.OpenFileCache.Init() + if err != nil { + return err + } + } return nil } diff --git a/pkg/serverconfigs/open_file_cache_config.go b/pkg/serverconfigs/open_file_cache_config.go new file mode 100644 index 0000000..0544f93 --- /dev/null +++ b/pkg/serverconfigs/open_file_cache_config.go @@ -0,0 +1,15 @@ +// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package serverconfigs + +const DefaultOpenFileCacheMax = 1024 + +// OpenFileCacheConfig open file cache配置 +type OpenFileCacheConfig struct { + IsOn bool `yaml:"isOn" json:"isOn"` + Max int `yaml:"max" json:"max"` +} + +func (this *OpenFileCacheConfig) Init() error { + return nil +}