I am trying to use redis cache (Microsoft.Extensions.Caching.Redis) with .net core 2.1 and for that purpose I had followed this tutorial https://dotnetcoretutorials.com/2017/01/06/using-redis-cache-net-core/ Now the issue is when I am trying to Get data using _distributedCache.GetStringAsync(key) I am getting this error "ERR unknown command 'EVAL'". I have also searched for this kind of error and found that this could happen because of older version of Redis but I am using latest version of Microsoft.Extension.Caching.Redis (version 2.1.1)
Here is my code:
public async Task<string> RetrieveCache(string key)
{
var data = await _distributedCache.GetStringAsync(key);
if (string.IsNullOrWhiteSpace(data))
return "";
return data;
}
appsettings.json:
"RedisServer": {
"Server": "12.66.909.61:6379,password=pwd",
"InstanceName": "Store.Toys"
}
and startup.cs
services.AddDistributedRedisCache(option =>
{
option.Configuration = Configuration["RedisServer:Server"];
option.InstanceName = Configuration["RedisServer:InstanceName"];
});
any help?