(keysInWindow int)
| 156 | } |
| 157 | |
| 158 | func newFastCache(keysInWindow int) *FastCache { |
| 159 | cache := fastcache.New(keysInWindow * maxKeyLength) |
| 160 | |
| 161 | // Enforce full initialization of internal structures. This is taken |
| 162 | // from GetPutBenchmark.java from java caffeine. It is required in |
| 163 | // caffeine given that it keeps buffering the keys for applying the |
| 164 | // necessary changes later. This is probably unnecessary here. |
| 165 | for i := 0; i < 2*workloadSize; i++ { |
| 166 | cache.Set([]byte(strconv.Itoa(i)), []byte("data")) |
| 167 | } |
| 168 | cache.Reset() |
| 169 | |
| 170 | return &FastCache{cache} |
| 171 | } |
| 172 | |
| 173 | //======================================================================== |
| 174 | // FreeCache |
no test coverage detected