MessagingRedisCache 3.0.0-rc.1

This is a prerelease version of MessagingRedisCache.
This package has a SemVer 2.0.0 package version: 3.0.0-rc.1+43cfc556.
dotnet add package MessagingRedisCache --version 3.0.0-rc.1
                    
NuGet\Install-Package MessagingRedisCache -Version 3.0.0-rc.1
                    
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="MessagingRedisCache" Version="3.0.0-rc.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MessagingRedisCache" Version="3.0.0-rc.1" />
                    
Directory.Packages.props
<PackageReference Include="MessagingRedisCache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MessagingRedisCache --version 3.0.0-rc.1
                    
#r "nuget: MessagingRedisCache, 3.0.0-rc.1"
                    
#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.
#:package MessagingRedisCache@3.0.0-rc.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MessagingRedisCache&version=3.0.0-rc.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MessagingRedisCache&version=3.0.0-rc.1&prerelease
                    
Install as a Cake Tool

MessagingRedisCache

MessagingRedisCache is an implementation of IDistributedCache using RedisCache as a base implementation. MessagingRedisCache will utilize Redis pub/sub to ensure that memory cache entries can be synchronized in a distributed system. This makes it a viable backing store for HybridCache, where it can evict IMemoryCache entries in distributed systems.

All changes to entries in MessagingRedisCache by way of removal or updates will result in a Redis message being published. The default implementation is to directly publish these messages in an established channel. Alternatively, keyevent notifications or keyspace notifications can be used if the Redis server is configured for them.

I expect to gracefully decomission this project when StackExchange.Redis has client-side caching support or if HybridCache similarly implements client-side eviction.

Configuration

It is intended that MessagingRedisCache be used in conjunction with another kind of layered caching solution, specificially HybridCache or L1L2RedisCache. Without any kind of layered cache solution, MessagingRedisCache will only publish Redis pub/sub messages for another consumer unconfigured by this project.

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

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

Message Subscription

A message subscriber can be registered on the IMessagingRedisCacheBuilder which will automatically evict cache entries from an IMemoryCache registered on the IServiceCollection:

services
    .AddMessagingRedisCache(options =>
    {
        options.Configuration = "redis";
        options.InstanceName = "Namespace:Prefix:";
    })
    .AddMemoryCacheSubscriber();

This is done automatically when using L1L2RedisCache, but should be done explicitly when using HybridCache. A complete HybridCache configuration could appear as such:

var services = new ServiceCollection();
services.AddHybridCache();
services.AddMessagingRedisCache(options =>
{
    options.Configuration = "redis";
    options.InstanceName = "MessagingRedisCache:Test:";
});
var serviceProvider = services.BuildServiceProvider();

var hybridCache = serviceProvider
    .GetRequiredService<HybridCache>();

MessagingRedisCacheOptions

MessagingRedisCacheOptions are an extension of the standard RedisCacheOptions. The following additional customizations are supported:

MessagingType

The type of message publishing system to use:

MessagingType Description Suggestion
Default Publish standard MessagingRedisCache pub/sub messages. Default behavior. The Redis server requires no additional configuration.
KeyeventNotifications Rely on keyevent notifications for message publishing instead of standard MessagingRedisCache 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 MessagingRedisCache.
KeyspaceNotifications Rely on keyspace notifications for message publishing instead of standard MessagingRedisCache 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 MessagingRedisCache.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MessagingRedisCache:

Package Downloads
L1L2RedisCache

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-rc.1 31 12/18/2025
0.0.1-beta.1 208 12/18/2025