降低ttlcache最大内存增量

This commit is contained in:
刘祥超
2021-12-03 10:22:03 +08:00
parent 9d54c17695
commit 38e2c151ec

View File

@@ -9,7 +9,7 @@ import (
// 最大的缓存时间为30 * 86400
// Piece数据结构
// Piece1 | Piece2 | Piece3 | ...
// [ Item1, Item2, ... | ...
// [ Item1, Item2, ... ] | ...
// KeyMap列表数据结构
// { timestamp1 => [key1, key2, ...] }, ...
type Cache struct {
@@ -26,7 +26,7 @@ func NewCache(opt ...OptionInterface) *Cache {
countPieces := 128
maxItems := 2_000_000
var delta = systemMemoryGB() / 4
var delta = systemMemoryGB() / 8
if delta > 0 {
maxItems *= delta
}