Snet.Redis 26.271.1

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

<h1 align="center">Redis</h1>

<p align="center"> <img width="120" height="120" src="https://api.snet.cn/pic/nuget.png" alt="Snet Logo"/> </p>

<p align="center"> <b>C# Redis连接库</b> </p>

<p align="center">

<img src="https://img.shields.io/badge/.NET-8.0%20%7C%2010.0-purple.svg"/> <img src="https://img.shields.io/badge/license-MIT-green"/> <img src="https://img.shields.io/github/stars/shunnet/Redis?style=social"/>

</p>

<p align="center"> 高性能 · 内存数据库 · 缓存 & 消息队列 </p>

<p align="center"> <a href="https://snet.cn"><b>🌐 官方网站</b></a> · <a href="https://github.com/shunnet/Redis"><b>📦 GitHub</b></a> </p>

📖 简介

在现代系统中,快速响应 / 缓存 / 会话存储 / 队列 等应用场景越来越常见。
shunnet/Redis 致力于提供一个 简洁 · 可靠 · 高性能 的内存数据库解决方案,作为缓存或服务组件的数据层支撑。

✨ 特点:

  • ⚡ 极致性能:数据操作均在内存中完成,避免磁盘 IO
  • 🛠 简洁接口:支持字符串、哈希、列表、集合、有序集合等操作
  • 🧩 模块化 & 可扩展:可灵活插入业务逻辑
  • 🖥 跨平台部署:支持 Windows / Linux / Docker
  • 🌱 轻量设计:无冗余依赖,快速集成

🎯 适用场景

  • 🔹 缓存层加速读写
  • 🔹 会话 / 状态管理
  • 🔹 简单队列 & 发布-订阅
  • 🔹 边缘 / 嵌入式服务组件
  • 🔹 微服务快速中间存储

🚀 快速开始

📦 安装方式

通过 NuGet 获取:

dotnet add package Snet.Redis

主要类 / 对象(示例)

  • RedisOperate(入口类)
    • 用法:RedisOperate redisOperate = RedisOperate.Instance(new RedisData.Basics { ... });
    • 责任:管理与 Redis 的连接、提供常用的键/值操作、批量命令入口、序列化/反序列化封装等。
  • RedisData.Basics(配置结构)
    • 常见字段(示例):ConnectStr("127.0.0.1:6379"), DataBaseID, Expiry(过期时间毫秒), TAG(键前缀)
  • 日志:示例中使用 Snet.Log.LogHelper 来记录运行信息(项目自带或依赖的日志封装)

💡 使用示例

using Snet.Log;
using Snet.Redis;
using Snet.Utility;

RedisOperate redisOperate = RedisOperate.Instance(new RedisData.Basics
{
    ConnectStr = "127.0.0.1:6379",
    DataBaseID = 0,
    Expiry = 86400000,
    TAG = "Samples:",
});

Console.WriteLine(redisOperate.Title());

LogHelper.Info(redisOperate.On().ToJson(true));
LogHelper.Info(redisOperate.KeyDelete("*").ToString());

for (int i = 0; i < 10000; i++)
{
    LogHelper.Info(i.ToString());
    string xmlstr = new data().ToXml();
    LogHelper.Info(redisOperate.StringSet($"A{i}", xmlstr).ToString());
    data? xml = redisOperate.StringGet($"A{i}")?.ToXmlEntity<data>();
    Console.WriteLine(xml.ToJson(true));
}

LogHelper.Info(redisOperate.Off().ToJson(true));

public class data
{
    public double a { get; set; } = new Random().NextDouble();
    public double b { get; set; } = new Random().NextDouble();
    public double c { get; set; } = new Random().NextDouble();
    public double d { get; set; } = new Random().NextDouble();
    public double e { get; set; } = new Random().NextDouble();
    public double f { get; set; } = new Random().NextDouble();
    public double g { get; set; } = new Random().NextDouble();
}

🔑 核心功能

模块 / 功能 描述
🔹 字符串 (String) 基础的 key-value 操作
🔹 哈希 (Hash) 存储对象字段、支持批量操作
🔹 列表 (List) 支持 push/pop、范围查询
🔹 集合 (Set) 无序集合,支持交并差运算
🔹 有序集合 (ZSet) 按分数排序的集合检索
🔹 发布 / 订阅 (Pub/Sub) 支持消息通信机制

🙏 致谢

📜 许可证

License: MIT

本项目基于 MIT 协议开源。
详情请阅读 LICENSE。

⚠️ 注意:本软件按 “原样” 提供,作者不对使用后果承担责任。

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 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. 
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
26.271.1 54 9/28/2026
26.256.1 90 9/13/2026
26.250.1 98 9/7/2026
26.236.1 98 8/24/2026
26.235.2 101 8/23/2026
26.235.1 111 8/23/2026
26.226.1 105 8/14/2026
26.222.1 102 8/10/2026
26.221.1 98 8/9/2026
26.220.1 99 8/8/2026
26.219.1 104 8/7/2026
26.216.1 119 8/4/2026
26.215.2 110 8/3/2026
26.215.1 117 8/3/2026
26.214.1 117 8/2/2026
26.211.1 118 7/30/2026
26.210.1 117 7/29/2026
26.197.1 94 7/16/2026
26.196.2 102 7/15/2026
26.196.1 125 7/15/2026
Loading failed