L1L2RedisCache 2.2.0

This package has a SemVer 2.0.0 package version: 2.2.0+a0abcdf0.
dotnet add package L1L2RedisCache --version 2.2.0
NuGet\Install-Package L1L2RedisCache -Version 2.2.0
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="L1L2RedisCache" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add L1L2RedisCache --version 2.2.0
#r "nuget: L1L2RedisCache, 2.2.0"
#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 L1L2RedisCache as a Cake Addin
#addin nuget:?package=L1L2RedisCache&version=2.2.0

// Install L1L2RedisCache as a Cake Tool
#tool nuget:?package=L1L2RedisCache&version=2.2.0

L1L2RedisCache

L1L2RedisCache is an implementation of IDistributedCache with a strong focus on performance. It leverages IMemoryCache as a level 1 cache and RedisCache as a level 2 cache, with level 1 evictions being managed via Redis pub/sub.

L1L2RedisCache is heavily inspired by development insights provided over the past several years by StackOverflow. It attempts to simplify those concepts into a highly accessible IDistributedCache implementation that is more performant.

Configuration

It is intended that L1L12RedisCache be used as an IDistributedCache implementation.

L1L2RedisCache can be registered during startup with the following IServiceCollection extension method:

services.AddL1L2RedisCache(options =>
{
    options.Configuration = "localhost";
    options.InstanceName = "Namespace:Prefix:";
});

L1L2RedisCache options are an extension of the standard RedisCache RedisCacheOptions. The following additional customizations are supported:

MessagingType

The type of messaging system to use for L1 memory cache eviction.

MessagingType Description Suggestion
Default Use standard L1L2RedisCache pub/sub messages for L1 memory cache eviction. Default behavior. The Redis server requires no additional configuration.
KeyeventNotifications Use keyevent notifications for L1 memory eviction instead of standard L1L2RedisCache pub/sub messages. The Redis server must have keyevent notifications enabled. This is only advisable if the Redis server is already using keyevent notifications with at least a ghE configuration and the majority of keys in the server are managed by L1L2RedisCache.
KeyspaceNotifications Use keyspace notifications for L1 memory eviction instead of standard L1L2RedisCache pub/sub messages. The Redis server must have keyspace notifications enabled. This is only advisable if the Redis server is already using keyevent notifications with at least a ghK configuration and the majority of keys in the server are managed by L1L2RedisCache.

Performance

L1L2RedisCache will generally outperform RedisCache, especially in cases of high volume or large cache entries. As entries are opportunistically pulled from memory instead of Redis, costs of latency, network, and Redis operations are avoided. Respective performance gains will rely heavily on the impact of afforementioned factors.

Considerations

Due to the complex nature of a distributed L1 memory cache, cache entries with sliding expirations are only stored in L2 (Redis). These entries will show no performance improvement over the standard RedisCache, but incur no performance penalty.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 2,983 11/19/2023
2.1.0 1,420 8/1/2023
2.1.0-rc.2 67 7/25/2023
2.1.0-rc.1 61 7/24/2023
2.0.2 4,861 11/12/2022
2.0.1 60 11/12/2022
2.0.0 63 11/12/2022
2.0.0-rc.2 110 12/29/2021
2.0.0-rc.1 89 12/27/2021
1.3.1 27,437 3/12/2021
1.3.0 294 12/21/2020
1.2.4-alpha.4 196 5/7/2020
1.2.3 6,802 3/16/2020
1.2.2 574 2/13/2020
1.2.1 569 10/15/2019
1.2.0 509 10/3/2019
1.1.7 662 8/15/2019
1.1.6 564 8/7/2019
1.1.5 592 7/22/2019
1.1.4 559 7/16/2019
1.1.2 573 6/24/2019
1.1.1 555 6/23/2019
1.1.0 930 3/11/2019
1.0.3 681 2/19/2019
1.0.2 806 12/24/2018
1.0.1 865 12/7/2018
1.0.0 1,053 10/4/2018