Skip to main content

CacheLib user guide

Cache library (CacheLib) is a C++ library for accessing and managing cache data. It is a thread-safe API that enables developers to build and customize scalable, concurrent caches.

Who should be using CacheLib?​

CacheLib is targeted at services that use gigabytes of memory to cache information. It provides an API similar to malloc and a concurrent unordered hash table for caching. Consider using cache and cachelib for your service if any of the following applies to the service:

  • Concurrent access with zero copy semantics.
  • Strict memory bounds — the cache lives within a configured size, never overruns it.
  • Variety of caching algorithms like LRU, TinyLFU, LRU2Q with TTL support.
  • Intelligent and automatic tuning of cache (pool rebalance, class rebalance) for dynamic changes to workload.
  • Shared-memory based persistence of cache across process restarts.
  • Transparent usage of DRAM and SSD for caching.

Getting started with CacheLib​

To get started with cachelib, read these guides:

Are you looking for a guide on how CacheLib is designed and how to add new features to it? Please refer architecture guide.