# facebook/CacheLib

Pluggable in-process caching engine to build and scale high performance services

Repository: https://github.com/facebook/CacheLib
Canonical: https://ross.abutalabs.com/products/cachelib
Homepage: https://www.cachelib.org
Language: C++
License: Apache-2.0
License Family: permissive
Topics: performance, cpp, cache, ssd, concurrency, cache-engine
Last push: 2026-08-26T18:16:10+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 99, longevity 100
- inputs: {"age_days": 2476, "days_push": 7, "days_rel": 9, "gap_med": 6.0, "n_releases_24m": 15}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1585, forks 322 (observed 2026-08-28T04:05:07.609491+00:00)

## What it is
CacheLib is a C++ library providing a pluggable, thread-safe in-process caching engine with transparent DRAM and SSD tiering. It includes CacheBench, a benchmarking and stress-testing tool for evaluating cache heuristics, configurations, and hardware choices.

## Use cases
- add high-throughput in-process caching to a C++ backend service
- cache data across DRAM and SSD transparently
- replace a multi-gigabyte evictable hash map with a scalable cache
- benchmark and compare cache eviction policies like LRU, TinyLFU, and 2Q
- evaluate hardware trade-offs between DRAM-only and hybrid DRAM+SSD caches
- persist cache contents across process restarts via shared memory
- stress test cache implementations for correctness and performance issues

## When to choose
- your service caches gigabytes of data and needs strict memory bounds
- you need concurrent, zero-copy cache access with low overhead
- you want automatic pool rebalancing and workload-adaptive tuning
- you need to evaluate cache heuristics or hardware choices with realistic workloads

## When to avoid
- you need a distributed cache with consistency or sharding across hosts
- you want a simple drop-in key-value store without C++ integration work
- your workload is small enough for a plain in-memory map
- you need a standalone cache server rather than an embedded library

## Facets
- artifact type: library
- maturity: active
- function: caching, benchmarking, concurrency
- domain: databases, performance, backend, developer-tools
- platform: cpp, self-hosted
- tags: in-process-cache, dram, ssd-caching, hybrid-cache, eviction-policies, thread-safe, facebook, cache-persistence, linux

## Member repositories
- facebook/CacheLib (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:07.609491+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:55:32.310787+00:00, confidence not recorded.
  - readme: https://github.com/facebook/CacheLib (fetched 2026-08-28T04:05:07.609491+00:00, sha 77b01944079a)
  - homepage: https://www.cachelib.org (fetched 2026-08-29T11:26:14.093461+00:00, sha de7dc56aef87)
  - site_page: https://cachelib.org/docs/installation (fetched 2026-08-29T11:26:14.102939+00:00, sha 6f70ef42bfe2)
  - site_page: https://cachelib.org/docs (fetched 2026-08-29T11:26:14.104936+00:00, sha 32af9595157b)
  - site_page: https://cachelib.org/docs/Cache_Library_User_Guides/Cachebench_Overview (fetched 2026-08-29T11:26:14.106689+00:00, sha e201e768c249)
  - site_page: https://cachelib.org/docs/Cache_Library_Architecture_Guide/overview_a_random_walk (fetched 2026-08-29T11:26:14.108319+00:00, sha 1714ab5209af)
- Data as of 2026-08-30T08:39:29.467469+00:00.
