Lycoris.CSRedisCore.Extensions
6.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Lycoris.CSRedisCore.Extensions --version 6.0.4
NuGet\Install-Package Lycoris.CSRedisCore.Extensions -Version 6.0.4
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="Lycoris.CSRedisCore.Extensions" Version="6.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lycoris.CSRedisCore.Extensions" Version="6.0.4" />
<PackageReference Include="Lycoris.CSRedisCore.Extensions" />
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 Lycoris.CSRedisCore.Extensions --version 6.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lycoris.CSRedisCore.Extensions, 6.0.4"
#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 Lycoris.CSRedisCore.Extensions@6.0.4
#: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=Lycoris.CSRedisCore.Extensions&version=6.0.4
#tool nuget:?package=Lycoris.CSRedisCore.Extensions&version=6.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CSRedisCore
扩展
当前版本请不要升级,删减了很多代码,因为实际使用中发现csredis会时不时的打不开连接,问题暂时未知
csreids 错误【******:6371/0】:Connection was not opened at CSRedis.CSRedisClient.GetAndExecuteAsync[T](RedisClientPool pool, Func`2 handerAsync, Int32 jump, Int32 errtimes)
当前版本删减为全静态服务
单实例例服务注册
CSRedisCoreBuilder.AddSingleRedisInstance(opt =>
{
opt.Host = "your host";
opt.Port = 6371;
opt.Password = "your password";
opt.SSL = false;
// 是否尝试集群模式,阿里云、腾讯云集群需要设置此选项为 false
opt.TestCluster = false;
opt.NewtonsoftJsonSerializerSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
DateFormatString = "yyyy-MM-dd HH:mm:ss.ffffff",
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
};
})
单实例服务使用
public class DemoService
{
public void RedisDemo()
{
//模糊查找所有键
var keys = RedisCache.Key.GetKeys("P:A");
// 获取缓存
var value = RedisCache.String.Get("A");
// 获取缓存
RedisCache.String.Set("A", "value");
// 使用方式和之前基本一致。 其他类型不做演示
// 分布式锁有略微变动
// 锁超时时间,单位:秒
var timeout = 10;
// 自动延长锁超时时间
var autoDelay = true;
// 尝试开启分布式锁,若失败立刻返回null
var Lock = RedisCache.Utils.Lock('key', timeout, autoDelay);
// 延时
Lock.Delay(1000);
// 刷新锁时间
Lock.Delay(10000);
// 解锁
Lock.Unlock();
// 其他玩法自己研究
}
}
多实例例服务注册
CSRedisCoreBuilder.AddMultipleRedisInstance("instanceA",opt =>
{
opt.Host = "your host";
opt.Port = 6371;
opt.Password = "your password";
opt.SSL = false;
// 是否尝试集群模式,阿里云、腾讯云集群需要设置此选项为 false
opt.TestCluster = false;
opt.NewtonsoftJsonSerializerSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
DateFormatString = "yyyy-MM-dd HH:mm:ss.ffffff",
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
};
});
CSRedisCoreBuilder.AddMultipleRedisInstance("instanceB",opt =>
{
opt.Host = "your host";
opt.Port = 6371;
opt.Password = "your password";
opt.SSL = false;
// 是否尝试集群模式,阿里云、腾讯云集群需要设置此选项为 false
opt.TestCluster = false;
opt.NewtonsoftJsonSerializerSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
DateFormatString = "yyyy-MM-dd HH:mm:ss.ffffff",
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
};
});
多实例服务使用
public class DemoService
{
public void RedisDemo()
{
var client = RedisCacheFactory.GetInstance("instanceA");
//模糊查找所有键
var keys = client.Key.GetKeys("P:A");
// 获取缓存
var value = client.String.Get("A");
// 获取缓存
client.String.Set("A", "value");
// 使用方式和之前基本一致。 其他类型不做演示
// 分布式锁有略微变动
// 锁超时时间,单位:秒
var timeout = 10;
// 自动延长锁超时时间
var autoDelay = true;
// 尝试开启分布式锁,若失败立刻返回null
var Lock = client.Utils.Lock('key', timeout, autoDelay);
// 延时
Lock.Delay(1000);
// 刷新锁时间
Lock.Delay(10000);
// 解锁
Lock.Unlock();
// 其他玩法自己研究
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 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. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- CSRedisCore (>= 3.8.670)
- Lycoris.Base (>= 6.0.6)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
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 |
---|---|---|
8.0.0 | 216 | 8/30/2025 |
6.2.0-rc | 117 | 12/10/2024 |
6.1.6 | 170 | 11/18/2024 |
6.1.6-rc | 135 | 9/18/2024 |
6.1.5 | 192 | 9/18/2024 |
6.1.5-rc | 137 | 9/17/2024 |
6.1.4 | 177 | 5/28/2024 |
6.1.3-rc | 132 | 4/11/2024 |
6.1.2 | 192 | 4/11/2024 |
6.1.2-rc | 126 | 4/10/2024 |
6.1.1 | 185 | 4/9/2024 |
6.1.0 | 329 | 10/25/2023 |
6.0.7 | 161 | 10/24/2023 |
6.0.6 | 178 | 10/20/2023 |
6.0.5 | 181 | 9/21/2023 |
6.0.4 | 278 | 3/30/2023 |
6.0.3 | 272 | 3/30/2023 |