High-performance, thread-safe in-memory caching primitives for .NET with advanced eviction policies.
BitFaster.Caching is a .NET library that provides high-performance, thread-safe in-memory caching primitives. It solves the problem of efficient data caching in concurrent applications by offering advanced eviction policies like 2Q and W-TinyLFU, which outperform traditional LRU approaches while maintaining scalability.
.NET developers building high-throughput applications that require efficient, concurrent in-memory caching with bounded size and predictable performance.
Developers choose BitFaster.Caching for its lock-free design, superior hit rates compared to basic LRU, and drop-in compatibility with ConcurrentDictionary, making it easy to integrate into existing codebases while significantly improving cache performance.
High performance, thread-safe in-memory caching primitives for .NET
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Designed for lock-free concurrency with high throughput and predictable latency, prioritizing scalability in concurrent environments, as highlighted in its philosophy.
Implements state-of-the-art policies like 2Q for LRU and W-TinyLFU for LFU, providing near-optimal hit rates that outperform traditional LRU caches, per the wiki documentation.
ConcurrentLru and ConcurrentLfu can be used just like ConcurrentDictionary with bounded size, making integration straightforward, as shown in the getting started examples.
Configurable atomic valueFactory ensures only one thread computes a value for a missing key, mitigating cache stampede issues, a key feature documented in the wiki.
Provides wrappers for IDisposable cache values with scoped lifetime management, enabling safe caching of resources that require cleanup, as detailed in the wiki.
Lacks built-in support for distributed caching or persistence, limiting use to single-instance applications unless combined with external storage solutions.
Advanced features like time-based eviction or metrics require setup and understanding of caching algorithms, which may be daunting for developers new to performance tuning.
Does not natively integrate with common .NET caching abstractions like IMemoryCache, necessitating custom implementations for frameworks like ASP.NET Core.
Documentation is wiki-based and may be less accessible or comprehensive compared to mainstream libraries, potentially slowing onboarding for some teams.