Redis is an open-source, in-memory data structure store. Redakt CMS offers Redis cache integration through an optional NuGet package. Redis is only suitable for very large distributed applications with many nodes. For most applications, the in-memory cache together with a distributed service bus is a better performing setup.

Installation

Install the Redis package with the NuGet package manager or the Package Manager Console.

PM> Install-Package Redakt.Providers.Redis

Service registration

Register Redis services in the ConfigureServices() method of your project's Startup.cs file by adding an AddRedisCache() call to the Redakt builder instance. The order in which services are added to the Redakt builder is not important.

public void ConfigureServices(IServiceCollection services)
{
    // ... framework and other services here

    var builder = services.AddRedakt();
    builder.AddRedisCache();  // Optionally pass Action<RedisCacheOptions> parameter.
    // ... other Redakt services
}

Configuration settings

The Redis cache is configured through the appsettings.json file. Any configuration that is not included in the appsettings.json file will be set to its default values. Additionally, an Action<RedisCacheOptions> configuration delegate may be passed to the AddRedisCache() call. Configuration set through this delegate takes priority and overrides values in the appsettings.json file.

{
    "Redakt": {
        "ApplicationCache": {
            "Redis": {
                "ConnectionString": "<your redis connection string>"
            }
        }
    }
}

Connection String

Required. Sets the connection string to the Redis instance.