Redis
How to install Redis with support for service bus, distributed caching and distributed concurrency lock.
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
Litium is tested with Redis version 5.0.5, other version may work but is not tested. When using Redis cluster for sharding or HA you may need to use Redis sentinel tunnel to have one endpoint that distribute the load to the different Redis instances.
Redis supports:
Installation
Packages for Redis can be installed from Litium's NuGet feed.
Install the package either with NuGet Package Manager Console or Manager. Please see the instructions below.
When the installation is complete, continue with the configuration.
Install with NuGet Package Manager Console
- Open NuGet Package Manager Console
- Select the Web project as Default project
- Install the package with the following command, and replace the version with the version of Litium you are using. If you want the latest package you can omit the version parameter.
Install-Package Litium.Web.Setup.Redis -Version [version]
Install the package from NuGet Package Manager
When installing from the package manager, select the correct version in the version selector before installing.
- Open NuGet Package Manager
- Find Litium.Web.Setup.Redis package
- Select the project to install into and select Install
- Update web.config or app.config with the connection string for Redis
Configuration
The implementation contains both service bus and distributed caching. To enable this function the connection string for the different redis implementation need to be added in web.config or app.config.
If you use multiple installation with the same Redis server you can add appSetting Litium:Redis:Prefix with the value of the application name in web.config or app.config.
Example
<appSettings>
<add key="Litium:Redis:Prefix" value="installation1:" />
</appSettings>