Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christian John Schmidt 9 posts 112 karma points
    Dec 12, 2019 @ 07:52
    Christian John Schmidt
    0

    Trouble clearing runtimecache on Umbraco cloud (Umbraco 7.12.5)

    I'm using Umbraco.Core.CacheHelper to save a list of news. Getting and inserting the items is no problem, but clearing the items on updates is however causing some problems for me.

    The code is fired in an ApplicationEventHandler on Contentservice.Published, and the code looks like this:

                        cache.RuntimeCache.InsertCacheItem("newsList", () => null); //Isn't cleared
                        cache.RuntimeCache.InsertCacheItem("newsList_date", () => null);  //Isn't cleared
                        cache.RuntimeCache.InsertCacheItem("newsListCache", () => null);  //Isn't cleared
                        cache.RuntimeCache.InsertCacheItem("newsListCacheTime", () => null); //Isn't cleared
    
                        cache.RuntimeCache.ClearCacheItem("newsList"); //Isn't cleared
                        cache.RuntimeCache.ClearCacheItem("newsList_date"); //Isn't cleared
                        cache.RuntimeCache.ClearCacheItem("newsListCache"); //Isn't cleared
                        cache.RuntimeCache.ClearCacheItem("newsListCacheTime"); //Isn't cleared
    

    I've tried to use both ClearCacheItem and InsertCacheItem with a null value - none of them works. The only thing that seems to work is to wait the 6 hours I've set as expire time

Please Sign in or register to post replies

Write your reply to:

Draft