Liwendong.CacheExtend.ServiceStackRedis 1.2.1

dotnet add package Liwendong.CacheExtend.ServiceStackRedis --version 1.2.1
                    
NuGet\Install-Package Liwendong.CacheExtend.ServiceStackRedis -Version 1.2.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="Liwendong.CacheExtend.ServiceStackRedis" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Liwendong.CacheExtend.ServiceStackRedis" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Liwendong.CacheExtend.ServiceStackRedis" />
                    
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 Liwendong.CacheExtend.ServiceStackRedis --version 1.2.1
                    
#r "nuget: Liwendong.CacheExtend.ServiceStackRedis, 1.2.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 Liwendong.CacheExtend.ServiceStackRedis@1.2.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=Liwendong.CacheExtend.ServiceStackRedis&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Liwendong.CacheExtend.ServiceStackRedis&version=1.2.1
                    
Install as a Cake Tool

Liwendong.CacheExtend.ServiceStackRedis

基于 ServiceStack.Redis 的缓存管理组件,实现 ICacheHelper 接口。

更新日志

1.2.0 (2026-10-15)

  • 新增:目标框架扩展为 net8.0;netcoreapp3.1;net451;net46;net47;net48(新增 net8.0 与 net48)
  • 说明:net8.0 与 netcoreapp3.1 同档使用 ServiceStack.Redis 8.8.0(原生支持 net8.0),.NET Framework 侧沿用 5.8.0,无行为变更

1.1.1 (2026-10-09)

  • 修复:实现IDisposable接口,修复连接池资源泄漏
  • 修复:构造函数参数误传给PooledRedisClientManager
  • 修复:Get<T>反序列化失败返回default(与其他实现一致)
  • 优化:默认过期时间从-1(永不过期)改为1天
  • 优化:Remove改用批量RemoveAll API
  • 优化:移除RemoveAll的静默吞异常
  • 优化:null检查统一使用nameof

1.1.0

  • 初始版本

功能特性

  • 实现 Liwendong.CacheExtend.ICacheHelper 接口
  • 支持缓存的基本操作:设置、获取、删除、检查存在
  • 支持按模式批量删除缓存
  • 使用 JSON 序列化存储对象
  • 支持连接池管理

安装

dotnet add package Liwendong.CacheExtend.ServiceStackRedis

使用示例

using Liwendong.CacheExtend.ServiceStackRedis;

// 创建实例
var cache = new ServiceStackRedisHelper("localhost", 6379, null, 86400, 0);

// 设置缓存
cache.Set("key", "value");
cache.Set("key", "value", 3600); // 1小时过期

// 获取缓存
var value = cache.Get<string>("key");

// 检查存在
bool exists = cache.Exists("key");

// 删除缓存
cache.Remove("key");
cache.Remove("key1", "key2", "key3");

// 按前缀删除
cache.RemoveByPattern("prefix_*");

注意事项

  • ServiceStack.Redis v4+ 是商业授权产品,生产使用请注意许可协议
  • RemoveAll 会清空整个 Redis 数据库,请谨慎使用
  • 建议实现 IDisposable 接口或使用单例模式管理实例生命周期

版本历史

1.2.1 (2026-10-17)

  • 修复:无密码时连接串格式(原会拼成 ""@host:port"");Set(key,value,seconds) 改相对过期并校验秒数;PooledRedisClientManager 构造参数注释与 poolSizeMultiplier 修正
  • 优化:ConvertHelper 序列化失败不再静默吞异常(写 Trace),Get<object> 误返 JSON 原文的问题
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 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 was computed.  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 was computed.  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 netcoreapp3.1 is compatible. 
.NET Framework net451 is compatible.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 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
1.2.1 81 10/20/2026
1.1.0 239 7/29/2025
1.0.1 636 7/18/2022
1.0.0 644 9/10/2021