Esempio n. 1
0
 private static void removedCallback(string key, Object value, CacheItemRemovedReason reason)
 {
     if (reason == CacheItemRemovedReason.Expired)
     {
         NoteRoll obj = (NoteRoll)value;
         // insertNew(key);		// Not needed to keep it always in memory.
     }
 }
Esempio n. 2
0
        private static NoteRoll insertNew(string room_name)
        {
            NoteRoll obj = new NoteRoll(room_name);                     // if concurrency happens, this will be done more than once.

            HttpRuntime.Cache.Insert(key(room_name), obj, null, DateTime.Now.AddSeconds(Config.DEFAULT_CACHE_SECONDS),
                                     Cache.NoSlidingExpiration, CacheItemPriority.Default, removedCallback);

            // expires after some time for multi-node synchronization (unreliable).
            return(obj);
        }
Esempio n. 3
0
        public static void AddNote(string room_name, NoteInfo info)
        {
            NoteStore.AddNote(room_name, info);

            NoteRoll obj = (NoteRoll)HttpRuntime.Cache.Get(key(room_name));

            if (obj != null)
            {
                obj.AddNote(info);
            }
        }
Esempio n. 4
0
        private static NoteRoll get(string room_name)
        {
            NoteRoll obj = (NoteRoll)HttpRuntime.Cache.Get(key(room_name));

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

            return(obj);
        }
Esempio n. 5
0
        public static IEnumerable <NoteInfo> Get(string room_name)
        {
            NoteRoll roll = get(room_name);

            return(roll.Get());
        }