mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 13:10:24 +08:00 
			
		
		
		
	实现open file cache
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								pkg/serverconfigs/open_file_cache_config.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								pkg/serverconfigs/open_file_cache_config.go
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user