RedisNet 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RedisNet --version 1.0.0                
NuGet\Install-Package RedisNet -Version 1.0.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="RedisNet" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RedisNet --version 1.0.0                
#r "nuget: RedisNet, 1.0.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 RedisNet as a Cake Addin
#addin nuget:?package=RedisNet&version=1.0.0

// Install RedisNet as a Cake Tool
#tool nuget:?package=RedisNet&version=1.0.0                

Local Test

Usage Method 1

Single redis server

Prerequisite

docker run --name redis1 -d -p 6379:6379  redis redis-server --appendonly yes
public void ConfigureServices(IServiceCollection services)
{
    var redis2ConfigurationOptions = ConfigurationOptions.Parse("localhost:6379");
    redis2ConfigurationOptions.ReconnectRetryPolicy = new ExponentialRetry(1000);
    services.AddRedisDotNet(new RedisCacheOptions()
    {
        ConfigurationOptions = redis2ConfigurationOptions
    });
}

public class TestController : Controller
{
    private readonly IRedisService _redisService;
    public TestController(IRedisService redisService){
        _redisService = redisService;
    }

    public IActionResult Get(string key){
        var result = _redisService.GetString(key);
        return OK(result);
    }

    public async Task<IActionResult> GetAsync(string key){
        var result = await _redisService.GetStringAsync(key);
        return OK(result);
    }
}


Usage Method 2

Multiple Redis servers

Prerequisite

docker run --name redis1 -d -p 6379:6379  redis redis-server --appendonly yes
docker run --name redis2 -d -p 6380:6380  redis redis-server --appendonly yes
public void ConfigureServices(IServiceCollection services)
{
    var redis1ConfigurationOptions = ConfigurationOptions.Parse("localhost:6379");
    redis1ConfigurationOptions.ReconnectRetryPolicy = new ExponentialRetry(1000);
    services.AddRedisDotNet<Redis1>(new RedisCacheOptions()
    {
       ConfigurationOptions = redis1ConfigurationOptions
    });

    var redis2ConfigurationOptions = ConfigurationOptions.Parse("localhost:6380");
    redis2ConfigurationOptions.ReconnectRetryPolicy = new ExponentialRetry(1000);
    services.AddRedisDotNet<Redis2>(new RedisCacheOptions()
    {
       ConfigurationOptions = redis2ConfigurationOptions
    });
}


public class Redis1 : RedisService<Redis1>
{
    public Redis1(IOptionsMonitor<RedisCacheOptions> cacheOptions) : base(cacheOptions)
    {
    }
}


public class Redis2 : RedisService<Redis2>
{
    public Redis2(IOptionsMonitor<RedisCacheOptions> cacheOptions) : base(cacheOptions)
    {
    }
}

public class Redis1Controller : ControllerBase
{
    private readonly Redis1 _redis1;

    public Redis1Controller(Redis1 redis1)
    {
        _redis1 = redis1;
    }

    [HttpGet]
    public async Task<IActionResult> Get()
    {
        return Ok(await _redis1.GetStringAsync("redis1"));
    }
}


public class Redis2Controller : ControllerBase
{
    private readonly Redis2 _redis2;

    public Redis2Controller(Redis2 redis2)
    {
        _redis2 = redis2;
    }

    [HttpGet]
    public async Task<IActionResult> Get()
    {
        return Ok(await _redis2.GetStringAsync("redis2"));
    }
}


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
1.2.1 8,179 5/12/2021
1.1.1 281 5/12/2021
1.1.0 291 5/10/2021
1.0.0 321 3/4/2021