(keysInWindow int)
| 110 | } |
| 111 | |
| 112 | func 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 |
no test coverage detected