Exemplo n.º 1
0
        public void Flush_RemovesTheExpiredItems()
        {
            var cache = new NanoCache <string, int>();

            cache.Set("1", 1, 10);
            Thread.Sleep(100);

            cache.Flush();

            Assert.AreEqual(0, cache.Count);
        }
Exemplo n.º 2
0
        public void Flush_DoesNothingForUnExpiredItems()
        {
            var cache = new NanoCache <string, int>
            {
                ["1"] = 1
            };

            cache.Flush();

            Assert.AreEqual(1, cache.Count);
        }
Exemplo n.º 3
0
        public void Flush_RemovesTheExpiredItemsWhileLeavingTheNormalOnes()
        {
            var cache = new NanoCache <string, int>();

            cache.Set("1", 1, 10);

            Thread.Sleep(100);

            cache["2"] = 2;
            cache.Flush();

            Assert.AreEqual(1, cache.Count);
        }