Toosame.Redis
1.0.3
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 Toosame.Redis --version 1.0.3
NuGet\Install-Package Toosame.Redis -Version 1.0.3
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="Toosame.Redis" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toosame.Redis --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Toosame.Redis, 1.0.3"
#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 Toosame.Redis as a Cake Addin #addin nuget:?package=Toosame.Redis&version=1.0.3 // Install Toosame.Redis as a Cake Tool #tool nuget:?package=Toosame.Redis&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Toosame.Redis
使用依赖服务注入的Redis客户端帮助类;对外暴露的接口返回格式都是使用基本数据类型和泛型,可以在多个项目中使用,不需要每个项目都安装StackExchange.Redis的Nuget包;
配置依赖服务注入
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
//添加Redis服务,DbIndex默认为-1的配置
services.AddRedisService("你的Redis连接字符串");
//添加Redis服务,DbIndex默认指定值
//services.AddRedisService("你的Redis连接字符串", 15);
}
}
在控制器中使用
public class DemoController : Controller
{
private readonly IRedisClient _redisClient;
public DemoController(IRedisClient redisClient)
{
_redisClient = redisClient;
}
[HttpGet]
public string Get()
{
//设置key-value为string类型的值,没有过期时间,使用默认的DbIndex
_redisClient.SetString("hello", "Hello World!");
//设置key-value为string类型的值,没有过期时间,使用指定的DbIndex
_redisClient.SetString("hello", "Hello World!", 15);
//设置key-value为string类型的值,过期时间为20分钟
_redisClient.SetString("hello", "Hello World!", System.TimeSpan.FromMinutes(20));
//设置key-value为string类型的值,过期时间为20分钟,使用指定的DbIndex
_redisClient.SetString("hello", "Hello World!", System.TimeSpan.FromMinutes(20), 15);
//获取key-value为string类型的值
string hello = _redisClient.GetString("hello");
//获取key-value为string类型的值,从指定的DbIndex中获取
string hello_for_db15 = _redisClient.GetString("hello", 15);
//...其他类型的方法介绍安装后解锁
return hello_for_db15;
}
}
Product | Versions 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 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. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.1
- Newtonsoft.Json (>= 11.0.2)
- StackExchange.Redis (>= 2.0.513)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.