GitShow/facebook/CacheLib
facebook

CacheLib

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

by facebook
cachecache-engineconcurrencycppperformancessd
Star on GitHubForkWebsite

C++

1.6k stars320 forks238 contributorsActive · 21h agoSince 2019v2026.06.29.00Apache-2.0

Meet the team

See all 238 on GitHub →
rlyerly
rlyerly159 contributions
r-barnes
r-barnes128 contributions
pbhandar2
pbhandar2126 contributions
jiayuebao
jiayuebao91 contributions
byahn0996
byahn099680 contributions
AlnisM
AlnisM80 contributions
haowu14
haowu1475 contributions
agordon
agordon64 contributions

Languages

View on GitHub →
C++87.3%
Python7%
CMake3%
Rust1.2%
Shell0.5%
Thrift0.4%
Other0.6%

Commit activity

Last 12 weeks · 302 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
87
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
gruenich
[ci] Update GitHub Action mozilla-actions/sccache-actionMergedPR

Fixes deprecation warning for node20.js

gruenich · 2w ago
williamnixon20
S3FIFO Eviction AlgorithmMergedPR

This PR adds the S3FIFO eviction algorithm, as described here. Running cachebench results show that S3FIFO achieves the highest hit rate among all evaluated algorithms. Throughput wise, it performs similarly with TinyLFU. Our implementation adapts the existing TinyLFUMM. Algorithm Detail The algorithm maintains three structures: S — a small queue for newly inserted items (10% of size) M — a main FIFO queue (90% of size) G — a ghost queue for items evicted from S (size of M), only tracks the object key hash. The general idea of the algorithm is: Evict early: items in S are aggressively filtered to not pollute the main cache. Promote late: promotion/reinsertion occurs only when an accessed item reaches the tail. Each object carries one access bit that records whether it has been accessed since it was inserted or last inspected. Items in the tail are: If accessed and in S, moved to M. If accessed and in M, reinserted to head of M. If not accessed, evict. If this item is evicted from S, move it to the ghost queue. Insertions are done as such: If the item exists in ghost, directly insert to M. Else insert to S. We try to do eviction from S if the size > expected size (10%). Else, we try to evict from main. Eviction iterator starts from tail and skips accessed items. Promotions (reinsertions) are done 1x before iterator is created. Benchmark: We evaluated S3FIFO using the test configurations in test_configs/hit_ratio with 48 threads and an 8 GB cache. We compared this against other existing MMContainers(LRU2Q, LRU, and TinyLFU). We use the DebugRel release version for testing. The results can be found here S3 FIFO Benchmark (2).pdf Miss ratio: S3FIFO consistently outperforms LRU, LRU2Q, and TinyLFU across all workloads. Throughput: Throughput is comparable to TinyLFU. Notes:** Adds an atomic FIFO ghost queue implemented as a bucketed hash table storing only object hashes. Each entry is tagged with a logical timestamp (number of inserts into G). Entries expire based on FIFO order: if current time is N, any entry with timestamp < (N − ) is considered expired. Entries are removed either when accessed (consume-on-hit) or when overwritten due to hash collisions.

williamnixon20 · 1mo ago
vj7-byte
docs: Improve README.md and CONTRIBUTING.mdMergedPR

Summary This pull request significantly enhances the README.md and CONTRIBUTING.md files to improve the developer experience for new users and contributors. Key Improvements to README.md Added Quick Start Section: A minimal, self-contained C++ code example has been added to help new users get started with CacheLib quickly. Added Key Features Section: A clear, concise list of CacheLib's main features has been included to highlight its capabilities. Added "Why Use CacheLib?" Section: This new section explains the ideal use cases for CacheLib and helps users understand when it is the right choice. Added Architecture Overview: A high-level overview of CacheLib's architecture has been added to provide context for new contributors. Improved Build Instructions: The build and installation steps have been consolidated and clarified for a smoother setup process. Added Community Section: Links to GitHub Issues, Discussions, and Stack Overflow have been added to help users find support. Key Improvements to CONTRIBUTING.md Added Documentation Contributions Section: Clear instructions have been added for contributors who wish to improve the documentation. Added Code Style Guidelines: A reference to the .clang-format file and code formatting expectations has been included. Added PR Template Information: The pull request process and template are now described to guide contributors. Improved Overall Clarity: The document has been reorganized for better readability. These changes aim to make CacheLib more accessible and welcoming to both new users and potential contributors. Test Plan This is a documentation-only change. All code examples have been reviewed for correctness. [x] Verified that the Quick Start code example is correct and compiles. [x] Reviewed all new sections for clarity and accuracy. [x] Checked all links to ensure they are valid.

vj7-byte · 1mo ago
Structured data for AI agents

Repository: facebook/CacheLib. Description: Pluggable in-process caching engine to build and scale high performance services Stars: 1563, Forks: 320. Primary language: C++. Languages: C++ (87.3%), Python (7%), CMake (3%), Rust (1.2%), Shell (0.5%). License: Apache-2.0. Homepage: https://www.cachelib.org Topics: cache, cache-engine, concurrency, cpp, performance, ssd. Latest release: v2026.06.29.00 (3d ago). Open PRs: 20, open issues: 0. Last activity: 21h ago. Community health: 87%. Top contributors: rlyerly, r-barnes, pbhandar2, jiayuebao, byahn0996, AlnisM, haowu14, agordon, therealgymmy, leozzx and others.

·@ofershap

Replace github.com with gitshow.dev