public void Notify() { string key = "bsmap1"; BsMap obj = (BsMap)HttpRuntime.Cache.Remove(key); if (obj != null) { insertNew(key); } }
private BsMap insertNew(string key) { BsMap obj = new BsMap(); // if concurrency happens, this will be done more than once. HttpRuntime.Cache.Insert(key, obj, null, DateTime.Now.AddSeconds(HeartsConfiguration.DEFAULT_CACHE_SECONDS), Cache.NoSlidingExpiration, CacheItemPriority.Default, removedCallback); // expires after some time for multi-node synchronization (unreliable). return(obj); }
public BsMap Get() { string key = "bsmap1"; BsMap obj = (BsMap)HttpRuntime.Cache.Get(key); if (obj == null) { obj = insertNew(key); } return(obj); }