开发者

Is there a way to invalidate or somehow refresh the cache on MvcSiteMap

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜