tstarling / thread-safe-lru

A C++ template class providing a thread-safe LRU cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thread-safe LRU Cache

A set of header-only C++ classes providing thread-safe LRU caches. Uses Intel's tbb::concurrent_hash_map.

  • ThreadSafeLRUCache is a single tbb::concurrent_hash_map with attached LRU list.
  • ThreadSafeScalableCache is a cache object built from a collection of ThreadSafeLRUCache objects, with items distributed by key hash. This allows it to serve a high rate of evictions/inserts without significant lock contention.
  • ThreadSafeStringKey is a reference-counting string object with a memoized hash value. This is recommended as a key object for the above two containers.

For indicative benchmarks to help with container selection, see the benchmarks page on the wiki.

About

A C++ template class providing a thread-safe LRU cache

License:Apache License 2.0


Languages

Language:C++ 95.3%Language:Perl 1.9%Language:CMake 1.6%Language:Shell 1.1%