ApeFree.DataStore.RedisStore 3.0.1

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

ApeFree.DataStore.RedisStore

<div align="center">

ApeFree.DataStore

基于 ApeFree.DataStore 的 Redis 分布式对象持久化存储扩展

NuGet Version License .NET Compatibility

</div>


📖 简介

ApeFree.DataStore.RedisStore 是 ApeFree.DataStore 面向分布式与网络存储场景的官方扩展包。它允许将内存中的复杂聚合对象直接持久化到 Redis 集中式键值数据库中,支持多进程、多微服务节点之间的数据状态共享。


🌟 核心特性

  • 介质无缝解耦:业务代码完全面向 IStore<T> 编程,与本地文件存储 API 完全统一。
  • 透明享受管道能力:存入 Redis 的数据同样支持 GZip / Deflate 压缩(大幅降低 Redis 内存占用与网络带宽)与 AES 对称加密(保障敏感配置在共享缓存中的安全)。
  • Jbin 极速二进制适配:支持使用 Jbin 格式存入 Redis,点云/大数组直接以二进制外置块存储,避免 Base64 膨胀。
  • 自适应写合并:继承 CoalesceMangedModel 的写折叠能力,高频更新对象状态时自动削峰,避免 Redis 被高频写请求打崩。

📦 安装方式

dotnet add package ApeFree.DataStore.RedisStore

🚀 快速上手

1. 基础用法

using ApeFree.DataStore;
using ApeFree.DataStore.RedisStore;
using ServiceStack.Redis;

// 1. 初始化 Redis 客户端连接
var client = new RedisClient("127.0.0.1", 6379);

// 2. 创建 Redis 存取配置并指定目标 Key
var settings = new RedisStoreAccessSettings(client, "App:Cluster:Config");

// 3. 构建 RedisStore 实例
var store = StoreFactory.Factory.CreateRedisStore<ClusterConfig>(settings, () => new ClusterConfig
{
    ClusterName = "AlphaNode",
    Port = 9001
});

// 4. 加载数据(若 Redis 中不存在则自动保存默认值)
store.Load();
Console.WriteLine($"集群名称: {store.Value.ClusterName}");

// 5. 修改并保存回 Redis
store.Value.Port = 9002;
store.Save();

2. 结合压缩与加密存入 Redis

using ApeFree.DataStore.Filters;
using System.IO.Compression;

// 自动对存入 Redis 的数据进行 GZip 压缩与 AES 加密
settings.StreamFilters.Add(new GZipStreamFilter(CompressionLevel.Optimal));
settings.StreamFilters.Add(new AesEncryptionStreamFilter(aesKey, aesIV));

store.Save(); // Redis 中存储的将是紧凑的加密密文

💾 配置选项字典

配置类 属性名称 类型 说明
RedisStoreAccessSettings Client IRedisClient Redis 客户端连接实例(构造函数必填)
Key string 存储的目标 Redis 键名(构造函数必填)
SerializationAdapter ISerializationAdapter 序列化适配器(支持 Jbin / Json / Xml,默认 Jbin)
StreamFilters IList<IStreamFilter> 流过滤器管道列表(支持 GZip、Deflate、AES 等)

📄 开源许可证

本项目基于 Apache-2.0 许可证开源。

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 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 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.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

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
3.0.1 96 11/19/2026
3.0.0 127 10/31/2026
1.0.6 467 7/21/2023
1.0.5 621 8/10/2022
1.0.4-Alpha0809 346 8/9/2022
1.0.3-Alpha0804 316 8/4/2022
1.0.2-Alpha0803 327 8/2/2022
1.0.1-Alpha0731 328 7/31/2022
1.0.0-Alpha0718 350 7/17/2022
0.9.0 662 7/4/2022