Symbol.Redis
1.1.0.17
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
.NET Framework 2.0
This package targets .NET Framework 2.0. The package is compatible with this framework or higher.
dotnet add package Symbol.Redis --version 1.1.0.17
NuGet\Install-Package Symbol.Redis -Version 1.1.0.17
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="Symbol.Redis" Version="1.1.0.17" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Symbol.Redis --version 1.1.0.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Symbol.Redis, 1.1.0.17"
#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 Symbol.Redis as a Cake Addin #addin nuget:?package=Symbol.Redis&version=1.1.0.17 // Install Symbol.Redis as a Cake Tool #tool nuget:?package=Symbol.Redis&version=1.1.0.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Symbol.Redis
dotnet core
- appsettings.json
{
//Redis配置
"RedisConfig": {
//连接参数,例如IP:端口
"connectionOptions": "127.0.0.1:6379,password=123456",
//扇区号(从0开始,redis db index)
"sector": 0,
//前辍
"prefix": "demo"
}
}
- Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.EnableHttp1AndHttp2();
builder.Services.AddControllers();
builder.Services.ConfigureRedis(builder.Configuration) //注入Redis组件
.AddSingleton<Demo>(); //注入单例:Demo
var app = builder.Build();
//尝试调用
var demo= app.ApplicationServices.GetRequiredService<Demo>();
demo.Foo();
app.Run();
- Demo.cs
using Symbol.Redis;
using Microsoft.Extensions.DependencyInjection;
public class Demo {
private RedisSector _redisSector;
public Demo(RedisSector redisSector){
_redisSector = redisSector; //来自依赖注入创建的单例对象
}
public void Foo(){
//读取redis中的值,实际从redis的dbIndex(0)中读取,key为“demo:test”
string value = await _redisSector.GetValueAsync("test");
Console.WriteLine($"Demo Foo value: {value}");
}
}
dotnet framework
- redis.config.json,
设置该文件为输出到目录
。
{
//连接参数,例如IP:端口
"connectionOptions": "127.0.0.1:6379,password=123456",
//扇区号(从0开始,redis db index)
"sector": 0,
//前辍
"prefix": "demo"
}
- Program.cs
using Symbol.Redis;
class Program{
static void Main(){
//加载redis配置文件并创建实例
var redisSector = RedisSector.Create("~/redis.config.json");
//读取redis中的值,实际从redis的dbIndex(0)中读取,key为“demo:test”
string value = await _redisSector.GetValueAsync("test");
Console.WriteLine($"Demo Foo value: {value}");
Console.ReadKey();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 is compatible. 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. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net20 is compatible. net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 is compatible. net46 is compatible. net461 is compatible. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Microsoft.Extensions.Options (>= 3.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 3.1.0)
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
.NETFramework 2.0
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 3.5
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.0
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.5
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.5.2
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.6
- StackExchange.Redis (>= 1.0.247)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.6.1
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.7
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
.NETFramework 4.8
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
net5.0
- Microsoft.Extensions.Options (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
net6.0
- Microsoft.Extensions.Options (>= 6.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 6.0.0)
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
-
net7.0
- Microsoft.Extensions.Options (>= 7.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- StackExchange.Redis (>= 2.6.96)
- Symbol (>= 4.0.0.31)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Please see https://github.com/symbolspace/Symbol.Redis/ for more information.