A thread-safe, header-only LRU cache for C++17.
- O(1) average-case
getandputoperations - Configurable capacity with LRU eviction
- Thread-safe with mutex-based synchronization
- Hit/miss rate tracking
#include <datacache/cache.h>
datacache::Cache<std::string, int> cache(1000);
cache.put("answer", 42);
auto val = cache.get("answer"); // std::optional<int>(42)mkdir build && cd build
cmake ..
make
ctestA Python reference implementation is included for performance comparison:
python3 scripts/benchmark.py