Add service in container:
```c#
public void ConfigureServices(IServiceCollection services)
{
services.AddDistributedRedisCache(opt => { opt.Configuration = "localhost:6379"; });
}
Set cache:
```c#
var info = new {Name = "xfh"};
var options = new DistributedCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromSeconds(20));
_cache.SetString(cacheKey, info.ToString(), options);
But,wirte into redis three keys and data type is hash instead of string
|key|value|
|---|---|
|absexp|-1|
|sldexp|200000000|
|data|{Name=xfh}|
In addition,IDistributedCache cannot use set,list,etc data struct of redis.
So,I don't think the IDistributedCache is suit for redis.,and I don't understand why design this interface.
Maybe I'm wrong,Thanks!
IDistributedCache is not intended as a means of interacting with arbitrary data in Redis. It's the other way around, Redis is used to store IDistributedCache data and state. You're welcome to store other data in Redis using Redis specific libraries.
OK,thank you!
Most helpful comment
IDistributedCache is not intended as a means of interacting with arbitrary data in Redis. It's the other way around, Redis is used to store IDistributedCache data and state. You're welcome to store other data in Redis using Redis specific libraries.