contain-rs / lru-cache

A cache that holds a limited number of key-value pairs
https://contain-rs.github.io/lru-cache/lru_cache/
Apache License 2.0
83 stars 36 forks source link

Construct the underlying map `with_capacity` #9

Open apasel422 opened 9 years ago

apasel422 commented 9 years ago

Since the capacity is restricted, it makes sense not to over- or underallocate on creation.

Gankra commented 9 years ago

One potential argument against this is that you might never get to the limit.

apasel422 commented 9 years ago

In that case, LruCache should expose a way to set the maximum size separately from the maximum storage capacity.

Gankra commented 9 years ago

s/maximum/minimum, but yeah that wouldn't be unreasonable.

jstnlef commented 8 years ago

I should be able to bang something out for this in the next hour or so if that's alright.

apasel422 commented 8 years ago

@jstnlef Go for it!