Beispiel #1
0
        public void Notify()
        {
            string key = "bsmap1";
            BsMap  obj = (BsMap)HttpRuntime.Cache.Remove(key);

            if (obj != null)
            {
                insertNew(key);
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public BsMap Get()
        {
            string key = "bsmap1";

            BsMap obj = (BsMap)HttpRuntime.Cache.Get(key);

            if (obj == null)
            {
                obj = insertNew(key);
            }

            return(obj);
        }