0
我发现redis散列键中存在“absexp”,“sldexp”和“data”字段。我可以使用_radius.setString/getString来设置和获取字段数据的值。但是,我怎样才能修改asp.net核心项目中的字段“absexp”?如何使用Microsoft.Extensions.Caching.Redis.Core设置asp.net核心项目中的过期时间
我发现redis散列键中存在“absexp”,“sldexp”和“data”字段。我可以使用_radius.setString/getString来设置和获取字段数据的值。但是,我怎样才能修改asp.net核心项目中的字段“absexp”?如何使用Microsoft.Extensions.Caching.Redis.Core设置asp.net核心项目中的过期时间
您是否试图更改缓存过期?
这样使用代码来创建一个对象DistributedCacheEntryOptions,当你将值设置为缓存,这样分配:
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
绝对到期可以选择对象上的类似的方法来设定,如果你不想滑动过期。
希望这会有所帮助。