allegro / allegro/bigcache

Evictions happening all at once

Đang mở
#239 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
8.2k
Fork
614
Merge trung bình
5 ngày 12 giờ
Pull request đã merge (30 ngày)
1

Mô tả

I have the following default configuration with an override just for HardMaxCacheSize 30 MB

```go
config := Config{
Shards: 1024,
LifeWindow: eviction,
CleanWindow: 1 * time.Second,
MaxEntriesInWindow: 1000 * 10 * 60,
MaxEntrySize: 500,
StatsEnabled: false,
Verbose: true,
Hasher: newDefaultHasher(),
HardMaxCacheSize: 0,
Logger: DefaultLogger(),
}
config := bigcache.DefaultConfig(10 * time.Minute)
config.HardMaxCacheSize = 30
return bigcache.NewBigCache(config)
```

I have three questions
1) I ran a test script with all additions (no updates and deletes). Been taking stats on number of entries in the cache using the cache.len() function and it shows the entries in the cache is increasing.
After the threshold of memory is crossed, as the additions are increasing, the entries in the cache as returned by len() is zero, instead of being steady at a fixed number.
What am I missing? I tried with diff settings for lifeWindow. In my case I do not want the entires to be evicted unless the cache is full and a new entry is taking its place

2) Is the 30 MB for HardMaxCacheSize pre-alloacated? My understanding is bigCache can add memory at run time so I would expect the cache to grow as the entires grow. But when I see the value of capacity() function, it is always from the beginning staying steady at something ~250 MB. Is this the initial shard size I have been reading about? How can I get it overridden with HardMaxCacheSize.

3) Is LRU impl being planned

Thanks
-Sai

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.