Esempio n. 1
0
 private void removedCallback(string key, Object value, CacheItemRemovedReason reason)
 {
     if (reason == CacheItemRemovedReason.Expired)
     {
         DiscussionList obj = (DiscussionList)value;
         insertNew(key, obj.BoardId);
     }
 }
Esempio n. 2
0
        public void Notify(string board_id)
        {
            string         key = SandId.CombineId("dlpond1", board_id);
            DiscussionList obj = (DiscussionList)HttpRuntime.Cache.Remove(key);

            if (obj != null)
            {
                insertNew(key, obj.BoardId);
            }
        }
Esempio n. 3
0
        private DiscussionList insertNew(string key, string board_id)
        {
            DiscussionList obj = new DiscussionList(board_id);                          // 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);
        }
Esempio n. 4
0
        public DiscussionList Get(string board_id)
        {
            string key = SandId.CombineId("dlpond1", board_id);

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

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

            return(obj);
        }
Esempio n. 5
0
        public override void ExecuteResult(ControllerContext context)
        {
            TextWriter writer = context.HttpContext.Response.Output;

            //using (JsonTextWriter writer = new JsonTextWriter(context.HttpContext.Response.Output))
            //{

            if (selectionId != null)
            {
                //string selection_name = SelectionInfoStore.GetSelectionName(this.selectionId);
                string selection_name = Warehouse.BsMapPond.Get().GetSelectionName(this.selectionId);
                //writer.WritePropertyName("selection_name");
                //writer.WriteValue(selection_name);
                writer.WriteForCrawler("h1", selection_name);
            }
            foreach (string board_id in this.boardList)
            {
                DiscussionList dl = Warehouse.DiscussionListPond.Get(board_id);
                dl.Write(writer);
            }
            //}
            //base.ExecuteResult(context);
        }