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.
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
精彩评论