lru
lru copied to clipboard
Mutable API: Specify initialSize independent of capacity
Hi,
Thank you for the great library!
For my scenario, it'd be preferable to not pre-allocate the capacity when initializing the Lru Hashtable. I'd like to be able to bound the growth, and make guarantees that we do not exceed a certain size, but not necessarily allocate the full set of memory up-front.
This isn't doable with the current API, because the capacity passed to the create method of the Mutable LRU is used to set the initial size of the Hashtbl.t.
To support this, I added an optional initialSize parameter to create - if not specified, it will default to capacity as before. If it is specified, it is used to set the initial size of the underlying hash table.