MCPcopy Create free account
hub / github.com/dgraph-io/dgraph-benchmarks / newBigCache

Function newBigCache

cachebench/cache_bench_test.go:112–134  ·  view source on GitHub ↗
(keysInWindow int)

Source from the content-addressed store, hash-verified

110}
111
112func newBigCache(keysInWindow int) *BigCache {
113 cache, err := bigcache.NewBigCache(bigcache.Config{
114 Shards: 256,
115 LifeWindow: 0,
116 MaxEntriesInWindow: keysInWindow,
117 MaxEntrySize: maxKeyLength,
118 Verbose: false,
119 })
120 if err != nil {
121 panic(err)
122 }
123
124 // Enforce full initialization of internal structures. This is taken
125 // from GetPutBenchmark.java from java caffeine. It is required in
126 // caffeine given that it keeps buffering the keys for applying the
127 // necessary changes later. This is probably unnecessary here.
128 for i := 0; i < 2*workloadSize; i++ {
129 _ = cache.Set(strconv.Itoa(i), []byte("data"))
130 }
131 _ = cache.Reset()
132
133 return &BigCache{cache}
134}
135
136//========================================================================
137// FastCache

Callers 1

BenchmarkCachesFunction · 0.85

Calls 2

SetMethod · 0.95
ResetMethod · 0.45

Tested by

no test coverage detected