(keysInWindow int)
| 187 | } |
| 188 | |
| 189 | func newFreeCache(keysInWindow int) *FreeCache { |
| 190 | cache := freecache.NewCache(keysInWindow * maxKeyLength) |
| 191 | |
| 192 | // Enforce full initialization of internal structures |
| 193 | // (probably not required, see above in bigcache) |
| 194 | for i := 0; i < 2*workloadSize; i++ { |
| 195 | _ = cache.Set([]byte(strconv.Itoa(i)), []byte("data"), 0) |
| 196 | } |
| 197 | cache.Clear() |
| 198 | |
| 199 | return &FreeCache{cache} |
| 200 | } |
| 201 | |
| 202 | //======================================================================== |
| 203 | // GroupCache |