Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable MvcSiteMapProvider caching

There seems to be automatic caching that happens with MvcSiteMapProvider. Is there a mechanism to disable caching? We have custom caching routines written and I want to run it through those instead of relying on any built in caching mechanism.

like image 694
Scott Avatar asked Feb 25 '23 07:02

Scott


2 Answers

Try to call Refresh before render menu or sitemap.

<% var sm = Html.MvcSiteMap();
((MvcSiteMapProvider.DefaultSiteMapProvider)sm.Provider).Refresh(); %>
....
<%: sm.Menu(0, 1) %>
like image 148
Sergey D Avatar answered Mar 02 '23 13:03

Sergey D


In MvcSiteMapProvider v4, the cache can now be extended or replaced with your own implementation. Have a look at the following blog post that I wrote.

MvcSiteMapProvider 4.0 - Extending the Cache

Under the covers it now uses System.Runtime.Caching.ObjectCache, an abstract class that can be replaced by a cache manager of your choosing.

like image 37
NightOwl888 Avatar answered Mar 02 '23 12:03

NightOwl888