https://github.com/lamerman/cpp-lru-cache
Simple and reliable LRU cache for c++ based on hashmap and linkedlist
https://github.com/lamerman/cpp-lru-cache
c-plus-plus lru-cache
Last synced: about 1 year ago
JSON representation
Simple and reliable LRU cache for c++ based on hashmap and linkedlist
- Host: GitHub
- URL: https://github.com/lamerman/cpp-lru-cache
- Owner: lamerman
- License: bsd-3-clause
- Created: 2013-06-20T12:57:51.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T12:53:18.000Z (almost 6 years ago)
- Last Synced: 2025-03-30T02:07:36.310Z (about 1 year ago)
- Topics: c-plus-plus, lru-cache
- Language: C++
- Homepage:
- Size: 238 KB
- Stars: 374
- Watchers: 13
- Forks: 111
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cpp-lru-cache
=============
Simple and reliable LRU (Least Recently Used) cache for c++ based on hashmap and linkedlist. The library is header only, simple test and example are included.
It includes standard components and very little own logics that guarantees reliability.
Example:
```
/**Creates cache with maximum size of three. When the
size in achieved every next element will replace the
least recently used one */
cache::lru_cache cache(3);
cache.put("one", "one");
cache.put("two", "two");
const std::string& from_cache = cache.get("two")
```
How to run tests:
```
mkdir build
cd build
cmake ..
make check
```