1
votes

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?

2

2 Answers

0
votes

The server needs to support the feature; it sounds like the server that you're targeting lacks support for this feature.

0
votes

Eval command according to documentation is supported since redis server version 2.6. You can find out what version do you have now on your remote server by

$ telnet 12.66.909.61 6379
#and type 
info

or using redis client - redis-cli -h 12.66.909.61 -p 6379 -a pwd info You will get

# Server
redis_version:2.8.24
...

Then you will need to upgrade redis-server package on your server upto 2.6