allegro / allegro/bigcache

Evictions happening all at once

Abierto
#239 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
8.2k
Forks
614
Merge medio
5 d 12 h
PR fusionados (30 d)
1

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.