NewLife.Redis.Extensions
7.0.2026.1024
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
<PackageReference Include="NewLife.Redis.Extensions" Version="7.0.2026.1024" />
<PackageVersion Include="NewLife.Redis.Extensions" Version="7.0.2026.1024" />
<PackageReference Include="NewLife.Redis.Extensions" />
paket add NewLife.Redis.Extensions --version 7.0.2026.1024
#r "nuget: NewLife.Redis.Extensions, 7.0.2026.1024"
#:package NewLife.Redis.Extensions@7.0.2026.1024
#addin nuget:?package=NewLife.Redis.Extensions&version=7.0.2026.1024
#tool nuget:?package=NewLife.Redis.Extensions&version=7.0.2026.1024
NewLife.Redis.Extensions
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:
- Uninstall the old package, install the new one
- Change namespace:
NewLife.Extensions.Caching.Redis→NewLife.Redis.Extensions - Switch DI registration:
services.AddRedis(configString)→services.AddDistributedRedisCache(options => {...})
Related Links
| Product | Versions 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. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.DataProtection (>= 3.1.32)
- Microsoft.Extensions.Caching.Abstractions (>= 3.1.32)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.32)
- Microsoft.Extensions.Options (>= 3.1.32)
- NewLife.Redis (>= 7.0.2026.1024)
- System.Drawing.Common (>= 4.7.3)
-
.NETStandard 2.0
- Microsoft.AspNetCore.DataProtection (>= 6.0.36)
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.1)
- NewLife.Redis (>= 7.0.2026.1024)
-
.NETStandard 2.1
- Microsoft.AspNetCore.DataProtection (>= 6.0.36)
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.1)
- NewLife.Redis (>= 7.0.2026.1024)
-
net10.0
- Microsoft.AspNetCore.DataProtection (>= 10.0.13)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options (>= 10.0.13)
- NewLife.Redis (>= 7.0.2026.1024)
-
net5.0
- Microsoft.AspNetCore.DataProtection (>= 5.0.17)
- Microsoft.Extensions.Caching.Abstractions (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
- NewLife.Redis (>= 7.0.2026.1024)
- System.Security.Cryptography.Pkcs (>= 6.0.5)
- System.Security.Cryptography.Xml (>= 6.0.1)
-
net6.0
- Microsoft.AspNetCore.DataProtection (>= 6.0.36)
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.1)
- NewLife.Redis (>= 7.0.2026.1024)
-
net7.0
- Microsoft.AspNetCore.DataProtection (>= 7.0.20)
- Microsoft.Extensions.Caching.Abstractions (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.1)
- NewLife.Redis (>= 7.0.2026.1024)
- System.Security.Cryptography.Pkcs (>= 7.0.3)
-
net8.0
- Microsoft.AspNetCore.DataProtection (>= 8.0.32)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- NewLife.Redis (>= 7.0.2026.1024)
-
net9.0
- Microsoft.AspNetCore.DataProtection (>= 9.0.21)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.21)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.21)
- Microsoft.Extensions.Options (>= 9.0.21)
- NewLife.Redis (>= 7.0.2026.1024)
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 |
升级至NewLife.Core 12与NewLife.Redis 7.0(跨主版本,需重新编译);运行时异常与日志消息接入31种语言词表,日志前缀不参与翻译;启用AOT/裁剪分析器门禁;程序集标题与包描述英文化并保留双语