Modern, fast and lightweight C++11 LRU in-memory cache implementation.
lruc::lru_cache::insert lruc::lru_cache::find lruc::lru_cache::contains lruc::lru_cache::remove
Amortized constant on average, worst case linear in the size of the cache.
lruc::lru_cache::clear
Linear in the size of the cache, i.e., the number of elements.
lruc::lru_cache::empty lruc::lru_cache::size lruc::lru_cache::max_size lruc::lru_cache::hit_count lruc::lru_cache::miss_count lruc::lru_cache::insert_count lruc::lru_cache::evict_count lruc::lru_cache::hit_count lruc::lru_cache::cbegin lruc::lru_cache::cend lruc::lru_cache::to_string
Constant.
using namespace lruc;
lru_cache<size_t, std::string> cache(42);
cache.insert(1, "Trent");
cache.insert(2, "Reznor");
cache.remove(1);
const lru_cache<size_t, std::string>::const_iterator value_iter = cache.find(2);
if (value_iter != cache.cend())
std::cout << value_iter->second;
else
std::cout << cache.to_string();
Copyright 2017 Aleksandr Dikanchukov
Licensed under the Apache License, Version 2.0