调整默认缓存容量

This commit is contained in:
刘祥超
2022-04-21 09:40:20 +08:00
parent adfdd5f1b6
commit 5e1f8f305c

View File

@@ -25,12 +25,12 @@ type Cache struct {
func NewCache(opt ...OptionInterface) *Cache {
var countPieces = 256
var maxItems = 2_000_000
var maxItems = 1_000_000
var totalMemory = utils.SystemMemoryGB()
if totalMemory < 2 {
// 我们限制内存过小的服务能够使用的数量
maxItems = 1_000_000
maxItems = 500_000
} else {
var delta = totalMemory / 8
if delta > 0 {