Reputation: 729
I find there are "absexp","sldexp" and "data" fields in a Redis hash key.
I can use _radius.setString/getString to set and get the value of field data. But how can I modify the field "absexp" in the ASP.NET core project?
Upvotes: 6
Views: 11461
Reputation: 139
Are you trying to change the cache expiration?
Use code like this to create an DistributedCacheEntryOptions object and assign when you set the value to cache so:
var options = new DistributedCacheEntryOptions(); // create options object
options.SetSlidingExpiration(TimeSpan.FromMinutes(1)); // 1 minute sliding expiration
_cache.SetString(cacheKey, value, options); // set key value pair with options
// your value will now expire after one minute
Absolute expiration can be set with a similar method on the option object if you don't want sliding expiration.
Hope this helps.
Upvotes: 5