I want to set cache to redis but I get an reror:
System.NullReferenceException: Object reference not set to an instance of an object.
My code
DistributedCacheEntryOptions options = new DistributedCacheEntryOptions();
options.AbsoluteExpiration = DateTime.Now.AddMinutes(1);
options.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1);
options.SlidingExpiration = TimeSpan.FromSeconds(30);
_distributedCache.SetString("zaman", DateTime.Now.ToString(), options);
Even though I filled in all the relevant fields, the code throws a System.NullReferenceException