示例#1
0
        public void Can_Clear_By_Expression()
        {
            var cacheContent1 = new MacroCacheContent();
            var cacheContent2 = new MacroCacheContent();
            var cacheContent3 = new MacroCacheContent();
            var cacheContent4 = new LiteralControl();

            AppCache.Get("TTes1t", () => cacheContent1);
            AppCache.Get("Tester2", () => cacheContent2);
            AppCache.Get("Tes3", () => cacheContent3);
            AppCache.Get("different4", () => cacheContent4);

            Assert.AreEqual(4, GetTotalItemCount);

            AppCache.ClearByRegex("^\\w+es\\d.*");

            Assert.AreEqual(2, GetTotalItemCount);
        }