BitFaster.Caching 2.1.3

.NET 6.0 .NET Core 3.1 .NET Standard 2.0
dotnet add package BitFaster.Caching --version 2.1.3
NuGet\Install-Package BitFaster.Caching -Version 2.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BitFaster.Caching" Version="2.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BitFaster.Caching --version 2.1.3
#r "nuget: BitFaster.Caching, 2.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BitFaster.Caching as a Cake Addin
#addin nuget:?package=BitFaster.Caching&version=2.1.3

// Install BitFaster.Caching as a Cake Tool
#tool nuget:?package=BitFaster.Caching&version=2.1.3

⚡ BitFaster.Caching

High performance, thread-safe in-memory caching primitives for .NET.

ConcurrentLru

ConcurrentLru is a light weight drop in replacement for ConcurrentDictionary, but with bounded size enforced by the TU-Q eviction policy (based on 2Q). There are no background threads, no global locks, concurrent throughput is high, lookups are fast and hit rate outperforms a pure LRU in all tested scenarios.

Choose a capacity and use just like ConcurrentDictionary, but with bounded size:

int capacity = 128;
var lru = new ConcurrentLru<string, SomeItem>(capacity);

var value = lru.GetOrAdd("key", (key) => new SomeItem(key));

ConcurrentLfu

ConcurrentLfu is a drop in replacement for ConcurrentDictionary, but with bounded size enforced by the W-TinyLFU admission policy. ConcurrentLfu has near optimal hit rate and high scalability. Reads and writes are buffered then replayed asynchronously to mitigate lock contention.

Choose a capacity and use just like ConcurrentDictionary, but with bounded size:

int capacity = 128;
var lfu = new ConcurrentLfu<string, SomeItem>(capacity);

var value = lfu.GetOrAdd("key", (key) => new SomeItem(key));

Documentation

Please refer to the wiki for full API documentation, and a complete analysis of hit rate, latency and throughput.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on BitFaster.Caching:

Package Downloads
NServiceBus.RabbitMQ The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

RabbitMQ support for NServiceBus

NServiceBus.AmazonSQS The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

An Amazon SQS transport implementation for NServiceBus

Xtensive.Orm

DataObjects.Net is the object-relational mapper (ORM) and business logic layer (BLL) framework

Harmony.Core

HarmonyCore package that provides base runtime functionality

BitFaster.Caching.DependencyInjection

BitFaster.Caching extensions for Microsoft.Extensions.DependencyInjection.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.3 2,716 3/17/2023
2.1.2 4,999 3/11/2023
2.1.1 64,088 10/14/2022
2.1.0 6,784 9/11/2022
2.0.0 201,011 7/29/2022
1.1.0 4,643 7/1/2022
1.0.7 113,285 2/13/2022
1.0.6 19,738 11/17/2021
1.0.5 6,540 11/10/2021
1.0.4 25,235 9/11/2021
1.0.3 32,944 5/31/2021
1.0.2 66,018 1/12/2021
1.0.1 24,046 7/9/2020
1.0.0 717 7/2/2020
0.9.4 721 6/19/2020
0.9.3 436 6/16/2020
0.9.2 392 6/15/2020
0.9.1 586 6/14/2020