allegro / allegro/bigcache

Evictions happening all at once

Open
#239 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.2k
Forks
614
Avg merge
5d 12h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.