folly icon indicating copy to clipboard operation
folly copied to clipboard

EvictingCacheMap - promotion on insertion when key already exists

Open adamfilli opened this issue 5 years ago • 0 comments

When inserting a new element into the EvictingCacheMap. i.e. auto [it, inserted] = cache.insert(key, value);, if the key already exists in the map, then inserted == false.

However, the act of inserting does not promote the element that was accessed, and so a subsequent call to find() needs to be made to promote the element stored at key.

It would be preferable if there was a way to either promote with only access to the iterator it, OR to have an input parameter (i.e. promote = true) to insert() that allows an existing element in the map to be promoted during the function call.

adamfilli avatar Apr 14 '21 16:04 adamfilli