SiteMapBase.FlushCache() obsolete in 4.2?
In the video here: http://www.sitefinity.com/blogs/joshmorales/posts/11-05-26/creating_intra-site_modules_in_sitefinity_4.aspx, at 20:38, it states to use "SiteMapBase.FlushCache();" to clear the cache. We've implemented a module using this, but now we can't compile as that method no longer exists in 4.2. I did not see this in the breaking changes documentation.
Could you please provide the alternative solution to this, and hopefully update the documentation to reflect this breaking change as well. Thank you.
Hello Amir,
This method is removed as it is not required any more. We have taken a different approach with the refactoring of the site map provider, and now when an item is changed the API sends a notification to invalidate cache dependencies for this particular item only. You do not need to clear the cache manually anymore.
Regards,
Radoslav Georgiev
the Telerik team
Great. Thank you.
Hello Amir,
Here some additional information on the subject.
We removed that method as it encourages bad practice. Since SiteMap nodes are dependent on so many things and flushing the entire cache too often makes it very inefficient. In most cases you should not need to take care of this as Sitefinity places appropriate cache dependencies for every cached node. This way only affected nodes will expire. The appropriate way of adding additional logic for node expiration is with custom cache dependencies. Unfortunately, working with custom cache dependencies is not documented yet.
In case you really need to flush the entire sitemap cache you can do it like this:
SystemManager.GetCacheManager(CacheManagerInstance.SiteMap).Flush();
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Makes sense. Thank you.