我正在尝试重置缓存条目的时间戳。我想知道如何实现这一目标。
现在我正在创建一个新实例 MemoryCacheEntryOptions
private MemoryCacheEntryOptions GetCacheOptions()
{
return new MemoryCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromSeconds(20)); // Cache for some seconds.
}
每次SetSlideExpiration()缓存数据出现在MemoryCacheEntry.
因此,如果
public bool hasCached(string key, byte[] values)
{
return _memoryCache.TryGetValue(GetDocStoreKey(key), out values);
}
返回true我应该能够重置 SetSlideExpiration 以从头开始计数。
噜噜哒
相关分类