SiteMapBase.FlushCache() obsolete in 4.2?

Posted by Community Admin on 03-Aug-2018 19:23

SiteMapBase.FlushCache() obsolete in 4.2?

All Replies

Posted by Community Admin on 12-Aug-2011 00:00

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.

Posted by Community Admin on 17-Aug-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-Aug-2011 00:00

Great. Thank you.

Posted by Community Admin on 23-Aug-2011 00:00

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();



Greetings,
Bob
the Telerik team

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 >>

Posted by Community Admin on 24-Aug-2011 00:00

Makes sense.  Thank you.

This thread is closed