mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	降低ttlcache最大内存增量
This commit is contained in:
		@@ -8,8 +8,8 @@ import (
 | 
				
			|||||||
// Cache TTL缓存
 | 
					// Cache TTL缓存
 | 
				
			||||||
// 最大的缓存时间为30 * 86400
 | 
					// 最大的缓存时间为30 * 86400
 | 
				
			||||||
// Piece数据结构:
 | 
					// Piece数据结构:
 | 
				
			||||||
//      Piece1          |  Piece2 | Piece3 | ...
 | 
					//      Piece1            |  Piece2 | Piece3 | ...
 | 
				
			||||||
//  [ Item1, Item2, ... |   ...
 | 
					//  [ Item1, Item2, ... ] |   ...
 | 
				
			||||||
// KeyMap列表数据结构
 | 
					// KeyMap列表数据结构
 | 
				
			||||||
// { timestamp1 => [key1, key2, ...] }, ...
 | 
					// { timestamp1 => [key1, key2, ...] }, ...
 | 
				
			||||||
type Cache struct {
 | 
					type Cache struct {
 | 
				
			||||||
@@ -26,7 +26,7 @@ func NewCache(opt ...OptionInterface) *Cache {
 | 
				
			|||||||
	countPieces := 128
 | 
						countPieces := 128
 | 
				
			||||||
	maxItems := 2_000_000
 | 
						maxItems := 2_000_000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var delta = systemMemoryGB() / 4
 | 
						var delta = systemMemoryGB() / 8
 | 
				
			||||||
	if delta > 0 {
 | 
						if delta > 0 {
 | 
				
			||||||
		maxItems *= delta
 | 
							maxItems *= delta
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user