Commit 3ff4b4f4 authored by Ranjeeth Dasineni's avatar Ranjeeth Dasineni Committed by Sara Golemon

move EvictingCacheMap to folly

Summary:
adding @agartrell's implementation of EvictingCacheMap to folly. Its a general purpose
cache with LRU eviction. It maintains a doubly linked list threaded throught a hash map using
boost::intrusive. set, get and delete are all constant time operations.  It is not thread safe.

Configurability: It allows callers to specify a hasher for the keys, has callbacks for eviction
events and the number of evictions on reaching a capacity limit is configurable. resizing for
a higher capacity though could be suboptimal since index is not resized accordingly and you could
end up with a bad load factor.

Test Plan: unit tests

Reviewed By: tulloch@fb.com, njormrod@fb.com

Subscribers: tulloch, chrisbray, mhx, doug, agartrell

FB internal diff: D1483789
parent be419a8e
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment