Pluto.Redis 1.1.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Pluto.Redis --version 1.1.0
NuGet\Install-Package Pluto.Redis -Version 1.1.0
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="Pluto.Redis" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pluto.Redis --version 1.1.0
#r "nuget: Pluto.Redis, 1.1.0"
#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.
// Install Pluto.Redis as a Cake Addin
#addin nuget:?package=Pluto.Redis&version=1.1.0

// Install Pluto.Redis as a Cake Tool
#tool nuget:?package=Pluto.Redis&version=1.1.0

pluto-redis

dotnet core redis 常用操作,基于StackExchange.Redis

使用方式

services.AddPlutoRedis(o =>
            {
                o.DefaultDbNumber = 0; 
                o.InstanceName = "test";
                o.Password = "pluto1002";
                o.MasterName = "redis-master"; // sentinel 模式的redis master名称
                o.IsSentinelModel = true;
                o.AllowAdmin = true;
                o.KeepAlive = 180;
                o.RedisAddress=new Dictionary<int, string>
                { 
                    // sentinel 或者普通模式 redis的地址
                    {26379,"127.0.0.1"},
                    {26380,"127.0.0.1"},
                    {26381,"127.0.0.1"},
                };
            });
  • 创建实例
var client = _serviceProvider.GetService<IPlutoRedisClient>();
var res= client.Set("demo", "123123qweqwew",3600);
// 使用自己的序列化工具
var res= client.Set("demo", ()=>JsonSerializer.Serialize<Demo>(new Demo { Name="123"}),3600);

 var str = aaa.Get("demo");
 var model = aaa.Get<Demo>("demo2", (str) => JsonSerializer.Deserialize<Demo>(str));

  • 获取db
var client = _serviceProvider.GetService<IPlutoRedisClient>();
var res= client.GetDatabase(3);
// 使用db的扩展方法
res.Set("asdasd","mkmkmkmk",200) // 和client中的基本方法一致。
res.Set("asdasd",()=>JsonSerializer.Serialize<Demo>(new Demo { Name="123"}),200) 
  • 分布式锁
// 获取锁
var client = _serviceProvider.GetService<IPlutoRedisClient>();
client.Lock("admin_lock",token,100) // return bool 

// 解锁
client.UnLock("admin_lock",token)
  • 发布订阅
var client = _serviceProvider.GetService<IPlutoRedisClient>();
// 发布
client.Publish<User>("demo",()=>JsonSerializer.Serialize(new { a="12321"}));

// 订阅
client.Subscribe("demo",Action<channel,string> callback);
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 was computed.  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. 
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

升级到net5.0