(keysInWindow int)
| 238 | } |
| 239 | |
| 240 | func newGroupCache(keysInWindow int) *GroupCache { |
| 241 | gc := &GroupCache{} |
| 242 | for i := 0; i < 256; i++ { |
| 243 | gc.shards[i] = lru.New(keysInWindow / 256) |
| 244 | } |
| 245 | |
| 246 | // Enforce full initialization of internal structures |
| 247 | for j := 0; j < 2*workloadSize; j++ { |
| 248 | _ = gc.Set([]byte(strconv.Itoa(j)), []byte("data")) |
| 249 | } |
| 250 | for i := 0; i < 256; i++ { |
| 251 | gc.shards[i].Clear() |
| 252 | } |
| 253 | |
| 254 | return gc |
| 255 | } |
| 256 | |
| 257 | //======================================================================== |
| 258 | // Ristretto |