Skip to content
Hüseyin Tuğrul BÜYÜKIŞIK edited this page Oct 4, 2021 · 6 revisions

Welcome to the LruClockCache wiki!

This is a header-only project that implements LRU-CLOCK-second-chance cache algorithm. It uses unordered_map and circular buffers to do book-keeping for get/set operations and cache-misses. Cache misses are handled by the cache but their functions are required to be given as constructor parameters. Whenever a cache slot is evicted, user-given cache-miss functions are called in order to optimize for more RAM-accesses and less backing-store accesses. LRU means least-recently-used eviction policy. Since CLOCK is an approximation, this is not a perfect "least recently" algorithm but is faster than Javascript version (that does 1.5 million lookups per second) of same algorithm because of C++ performance difference (20 million lookups per second in C++).