NewLife.Redis.Extensions 7.0.2026.1024

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package NewLife.Redis.Extensions --version 7.0.2026.1024
                    
NuGet\Install-Package NewLife.Redis.Extensions -Version 7.0.2026.1024
                    
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="NewLife.Redis.Extensions" Version="7.0.2026.1024" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewLife.Redis.Extensions" Version="7.0.2026.1024" />
                    
Directory.Packages.props
<PackageReference Include="NewLife.Redis.Extensions" />
                    
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 NewLife.Redis.Extensions --version 7.0.2026.1024
                    
#r "nuget: NewLife.Redis.Extensions, 7.0.2026.1024"
                    
#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 NewLife.Redis.Extensions@7.0.2026.1024
                    
#: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=NewLife.Redis.Extensions&version=7.0.2026.1024
                    
Install as a Cake Addin
#tool nuget:?package=NewLife.Redis.Extensions&version=7.0.2026.1024
                    
Install as a Cake Tool

NewLife.Redis.Extensions

Nuget Nuget Downloads

ASP.NET Core Redis Deep Integration Extensions

NewLife.Redis.Extensions is the official ASP.NET Core integration package for NewLife.Redis, providing out-of-the-box support for IDistributedCache distributed caching, IDataProtection key persistence, and automatic DI registration.

🆕 This is the successor to the deprecated NewLife.Extensions.Caching.Redis (v5.5). If you are using the old package, see the Migration Guide.


Feature Overview

Feature Description
IDistributedCache ASP.NET Core standard distributed cache interface
IDataProtection Persist data protection keys to Redis (PersistKeysToRedis)
DI Integration Single AddDistributedRedisCache call registers all services
Inherits FullRedis RedisCache inherits FullRedis — full data structure access
Broad Framework Coverage netcoreapp3.1 / net5.0 ~ net10.0 / netstandard2.0 / netstandard2.1

Installation

dotnet add package NewLife.Redis.Extensions

Quick Start

Register Services

using NewLife.Redis.Extensions;

var builder = WebApplication.CreateBuilder(args);

// One-liner: registers FullRedis / IDistributedCache / ICache / ICacheProvider
builder.Services.AddDistributedRedisCache(options =>
{
    options.Server   = "127.0.0.1:6379";
    options.Password = "pass";
    options.Db       = 0;
    options.Prefix   = "myapp:";
});

Using IDistributedCache

public class HomeController : Controller
{
    private readonly IDistributedCache _cache;

    public HomeController(IDistributedCache cache)
    {
        _cache = cache;
    }

    public async Task<IActionResult> Index()
    {
        var value = await _cache.GetStringAsync("greeting");
        if (value == null)
        {
            value = "Hello, Redis!";
            await _cache.SetStringAsync("greeting", value,
                new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1) });
        }
        return Content(value);
    }
}

Using FullRedis for Complete Redis Access

Since RedisCache inherits from FullRedis, you can use all Redis data structures directly after injection:

public class UserService
{
    private readonly FullRedis _redis;

    public UserService(FullRedis redis)
    {
        _redis = redis;
    }

    public void SaveUser(User user)
    {
        var list = _redis.GetList<User>("users");
        list.Add(user);

        var hash = _redis.GetDictionary<String>("user:" + user.Id);
        hash["Name"]  = user.Name;
        hash["Email"] = user.Email;
    }
}

Data Protection Key Persistence

builder.Services.AddDataProtection()
    .PersistKeysToRedis(redis, "DataProtection-Keys");

For more Redis operations, see the NewLife.Redis main documentation.


Migrating from the Old Package

This is the direct successor to NewLife.Extensions.Caching.Redis (v5.5), offering better architecture and more features:

Comparison NewLife.Extensions.Caching.Redis (Old) NewLife.Redis.Extensions (New)
Version Series v5.5 v6.5+
IDistributedCache ✅ ✅
IDataProtection Persistence ❌ ✅
Framework Coverage net461; netstandard2.0; netstandard2.1 netcoreapp3.1 ~ net10.0; netstandard2.0/2.1
RedisCache Base Class Standalone class, wraps FullRedis Inherits FullRedis, full API available
Namespace NewLife.Extensions.Caching.Redis NewLife.Redis.Extensions

Migration Steps:

  1. Uninstall the old package, install the new one
  2. Change namespace: NewLife.Extensions.Caching.Redis → NewLife.Redis.Extensions
  3. Switch DI registration: services.AddRedis(configString) → services.AddDistributedRedisCache(options => {...})

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on NewLife.Redis.Extensions:

Package Downloads
CodeRule

业务流水号规则生成器,便于快速生成流水号

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.0.2026.1026-beta0931 96 10/26/2026
7.0.2026.1024 370 10/24/2026
7.0.2026.1024-beta0503 103 10/24/2026
6.6.2026.1022-beta0149 95 10/22/2026
6.6.2026.1019-beta1511 167 10/19/2026
6.6.2026.1019-beta0424 99 10/19/2026
6.6.2026.1018-beta1724 104 10/18/2026
6.6.2026.1017-beta1441 109 10/17/2026
6.6.2026.1016-beta0908 119 10/16/2026
6.6.2026.1016-beta0852 113 10/16/2026
6.6.2026.901 873 9/1/2026
6.6.2026.901-beta0429 125 9/1/2026
6.6.2026.805-beta0751 183 8/5/2026
6.6.2026.801 230 8/1/2026
6.6.2026.801-beta1800 144 8/1/2026
6.5.2026.713-beta0858 170 7/13/2026
6.5.2026.701 1,799 7/1/2026
6.5.2026.701-beta1659 146 7/1/2026
6.5.2026.701-beta1523 141 7/1/2026
6.5.2026.622-beta1600 144 6/22/2026
Loading failed

升级至NewLife.Core 12与NewLife.Redis 7.0(跨主版本,需重新编译);运行时异常与日志消息接入31种语言词表,日志前缀不参与翻译;启用AOT/裁剪分析器门禁;程序集标题与包描述英文化并保留双语