更新时间:2023-02-25 19:14:41
hhh3112,
在缓存过期时,您可以使用一个回调。你能解释一下多一点。我不知道你的意思的过程必须在日常的确切小时执行。
You can use a callback when the cache expires. can you explain a little more. I am not sure what you mean by the process has to execute on an exact hour of everyday.
string test = "test1";
Cache.Insert("Key", test, dependancy, DateTime.Now.AddMinutes(DateTime.Now), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, new CacheItemRemovedCallback(CacheRemovedCallback));
public string CacheRemovedCallback(String key, object value, System.Web.Caching.CacheItemRemovedReason removedReason)
{
//Do something here
return = "Cache Expired for : " + key;
}