This libarary extends xCache to use Redis as the underlying store.
The library is available on nuget
install-package xCache.Redis
Register your preffered caching service to the ICache interface through your DI container.
//Register
Ioc.RegisterInstance<IConnectionMultiplexer>(ConnectionMultiplexer.Connect("localhost"));
Ioc.RegisterInstance<IRedisValueSerializer>(new JsonRedisValueSerializer());
Ioc.RegisterType<ICache, xCache.Redis.RedisCache>();
Resolve ICache and handle your caching needs
var cache = Ioc.Resolve<ICache>();
var key = "testKey";
var result = cache.Get<string>(key);
if(result == null)
{
result = GetResult();
//Cache for 5 minutes
cache.Add<string>(key, result, new Timespan(0,5,0));
}
xCache.Redis is compliant with Aspect oriented programming (Aop)
See the xCache readme for more information.
0.2.1
Please note that [email protected] is only compatible with the [email protected]
MIT