Пример #1
0
        public void Can_Remove_By_Strong_Type()
        {
            var cacheContent1 = new MacroCacheContent();
            var cacheContent2 = new MacroCacheContent();
            var cacheContent3 = new MacroCacheContent();
            var cacheContent4 = new LiteralControl();

            AppCache.Get("Test1", () => cacheContent1);
            AppCache.Get("Test2", () => cacheContent2);
            AppCache.Get("Test3", () => cacheContent3);
            AppCache.Get("Test4", () => cacheContent4);

            Assert.AreEqual(4, GetTotalItemCount);

            AppCache.ClearOfType <MacroCacheContent>();

            Assert.AreEqual(1, GetTotalItemCount);
        }
Пример #2
0
        public void Can_Remove_By_Type_Name()
        {
            var cacheContent1 = new MacroCacheContent();
            var cacheContent2 = new MacroCacheContent();
            var cacheContent3 = new MacroCacheContent();
            var cacheContent4 = new LiteralControl();

            AppCache.Get("Test1", () => cacheContent1);
            AppCache.Get("Test2", () => cacheContent2);
            AppCache.Get("Test3", () => cacheContent3);
            AppCache.Get("Test4", () => cacheContent4);

            Assert.AreEqual(4, GetTotalItemCount);

            //Provider.ClearCacheObjectTypes("umbraco.MacroCacheContent");
            AppCache.ClearOfType(typeof(MacroCacheContent).ToString());

            Assert.AreEqual(1, GetTotalItemCount);
        }