The purpose of this library is to store cache data, the infrastructure "StackExchange.Redis" is fed, but this library offers more generic and clean architecture. This library was developed .NET Standard.
- StringSet
- SortedSet
- Set
Install-Package TStack.RedisExchange -Version 1.0.3
dotnet add package TStack.RedisExchange --version 1.0.3
<PackageReference Include="TStack.RedisExchange" Version="1.0.3" />
paket add TStack.RedisExchange --version 1.0.3
This library supports cluster mode, for usage follow steps.
Define Redis Context Config
public class RedisContext : RedisContextConfig
{
public RedisContext() : base(new List<RedisServer> { new RedisServer("localhost", 6379)}, "", "ClientName", 15000, 15000)
{
}
}
Define Provider
public class ProjectProvider : RedisProvider<RedisContext>
{
}
Ready to use.
All redis functions need a key parameter for keep data, so you can access with this data from cache from key parameter.
An example for StringSet
ProjectProvider _provider = new ProjectProvider();
Person person = new Person("ferhat","candas");
var expire = new TimeSpan(0, 0, 5);
provider.Add("stringsetkey", person, expire);
For more example, than look tests
Ferhat Candaş - Software Developer
- Mail : candasferhat61@gmail.com
- LinkedIn : https://www.linkedin.com/in/ferhatcandas