1、新增緩存
var cache = HttpRuntime.Cache;
cache.Insert(緩存名稱, 緩存數據, null, Cache.NoAbsoluteExpiration,
new TimeSpan(0, 絕對過期時間(分鍾), 0), CacheItemPriority.Default, CachedItemRemoveCallBack[回調函數]);
2、緩存回調函數(緩存到期后需要重新添加緩存)
/// <summary>
/// 緩存到期后的回調函數
/// </summary>
/// <param name="key">緩存名稱</param>
/// <param name="value">緩存的值</param>
/// <param name="reason">緩存到期的原因</param>
private void CachedItemRemoveCallBack(string key, object value,
CacheItemRemovedReason reason)
{}
