Beispiel #1
0
        public static void TestEnqueue()
        {
            LimitedQueue <int> queue = new LimitedQueue <int>(3);

            queue.Add(1);
            queue.Add(2);
            queue.Add(3);
            Assert.AreEqual(queue.Count, 3);
            queue.Add(4);
            Assert.AreEqual(queue.Count, 3);
        }
        public static void Add(ChatMessage message)
        {
            LimitedQueue <ChatMessage> h = GetOrCreateRoomHistory(message.RoomID);

            if (h != null)
            {
                message.CreationDate = Data.Repository.CurrentDate;
                h.Add(message);

                Task.Run(() => {
                    CacheHandler.Instance.Replace <LimitedQueue <ChatMessage> >(CacheKey(message.RoomID), h, null);
                });
            }
        }