Closed
Description
Clarification and motivation
Since otter supports cost-based eviction, we cannot pre-initialize internal structures, but in reality this feature is rarely used, and other users may not be happy because otter allocated more memory than it could. So we would like to add an InitialCapacity
function with which users could preallocate otter's internal data structures.
The usage is envisioned like this
c, err := otter.MustBuilder[int, int](size).
InitialCapacity(size).
WithTTL(time.Second).
Build()
Acceptance criteria
- The
InitialCapacity
function is added to the builder. - Implementation tests are written