内存缓存增加最大数量限制

This commit is contained in:
GoEdgeLab
2021-09-19 16:11:46 +08:00
parent 6201de75e9
commit 8e76e53283
2 changed files with 2 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ type Cache struct {
func NewCache(opt ...OptionInterface) *Cache {
countPieces := 128
maxItems := 1_000_000
maxItems := 10_000_000
for _, option := range opt {
if option == nil {
continue

View File

@@ -65,6 +65,7 @@ func TestCache_Read(t *testing.T) {
for i := 0; i < 10_000_000; i++ {
cache.Write("HELLO_WORLD_"+strconv.Itoa(i), i, time.Now().Unix()+int64(i%10240)+1)
}
time.Sleep(10 * time.Second)
total := 0
for _, piece := range cache.pieces {