In the master branch commit 13024c7bdb7e6df119fb0d8f3bfdbfc86779b78c it is not possible to use caches with max-cost 40 or lower (num counters = max-cost * 10). Gets from smaller caches fail reliably. This limitation was not present in the latest tagged release.
This can be tested using the example code on your github page:
func main() {
cache, err := ristretto.NewCache(&ristretto.Config{
NumCounters: 400,
MaxCost: 40,
BufferItems: 64,
})
if err != nil {
panic(err)
}
// set a value with a cost of 1
cache.Set("key", "value", 1)
// wait for value to pass through buffers
time.Sleep(10 * time.Millisecond)
value, found := cache.Get("key")
if !found {
panic("missing value")
}
fmt.Println(value)
cache.Del("key")
}