Closed
Description
I wrote a demo for otter, and its results puzzled me.
Otter uses the S3 FIFO eviction strategy, which works as shown in the following gif:
But in my demo, otter cleared the "0" that was hit the most.
package main
import (
"fmt"
"time"
"github.com/maypok86/otter"
)
func main() {
t, err := otter.MustBuilder[int, int](64).Build()
if err != nil {
panic(err)
}
for i := range 128 {
t.Set(i, i)
t.Get(0)
}
fmt.Println(t.Get(0)) // 0 true
time.Sleep(time.Second) // wait for eviction
fmt.Println(t.Get(0)) // 0 false
}
Metadata
Assignees
Labels
No labels