MCPcopy Create free account
hub / github.com/allegro/bigcache / TestIterateOnResetCache

Function TestIterateOnResetCache

bigcache_test.go:874–896  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

872}
873
874func TestIterateOnResetCache(t *testing.T) {
875 t.Parallel()
876
877 // given
878 cache, _ := New(context.Background(), Config{
879 Shards: 8,
880 LifeWindow: time.Second,
881 MaxEntriesInWindow: 1,
882 MaxEntrySize: 256,
883 })
884 keys := 1337
885
886 // when
887 for i := 0; i < keys; i++ {
888 cache.Set(fmt.Sprintf("key%d", i), []byte("value"))
889 }
890 cache.Reset()
891
892 // then
893 iterator := cache.Iterator()
894
895 assertEqual(t, false, iterator.SetNext())
896}
897
898func TestGetOnResetCache(t *testing.T) {
899 t.Parallel()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
SetMethod · 0.80
IteratorMethod · 0.80
SetNextMethod · 0.80
assertEqualFunction · 0.70
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…