Open Yiling-J opened 1 year ago
From Ristretto's Readme FAQ:
As for "shortcuts," the only thing Ristretto does that could be construed as one is dropping some Set calls
So both set and setTags may return false when using Ristretto. Maybe better to mention it in readme or do something in code.
And here is a simple parallel benchmark to demonstrate that:
func BenchmarkRistrettoSetParallel(b *testing.B) { ctx := context.Background() client, err := ristretto.NewCache(&ristretto.Config{ NumCounters: 1000, MaxCost: 100, BufferItems: 64, }) if err != nil { panic(err) } store := NewRistretto(client, nil) b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { key := fmt.Sprintf("test-%d", i) value := []byte(fmt.Sprintf("value-%d", i)) err := store.Set(ctx, key, value, lib_store.WithTags([]string{fmt.Sprintf("tag-%d", i)})) if err != nil { fmt.Print("x") } i++ } }) }
you'll see some "x" when running it
From Ristretto's Readme FAQ:
So both set and setTags may return false when using Ristretto. Maybe better to mention it in readme or do something in code.
And here is a simple parallel benchmark to demonstrate that:
you'll see some "x" when running it