Domanda

Currently I have an MvcSiteMap integrated with my ASP.Net MVC app. I need to be able to invalidate or refresh the cache to force a read of the MvcSiteMap. Currently it's cache is set in the web.config to X minutes.

It would be nice if I could somehow force a refresh.

È stato utile?

Soluzione

You can specify a 'CacheKey' in your web.config which MvcSiteMap will use as the Http Cache keyname.

Then, in your web app, just expire or remove the key from cache. MvcSiteMap has a callback it uses to rebuild the map.

Check out the source code at http://mvcsitemap.codeplex.com/SourceControl/changeset/view/b5a6d902d512#Source%2fsrc%2fMvcSiteMapProvider%2fMvcSiteMapProvider%2fDefaultSiteMapProvider.cs - search for cacheKey

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top