开发者

how i can use cache in client side browser?

i have a website who have a list of infor开发者_运维知识库mation on the front page. the left side and right side bar have some information who rarely to update so i thing that i need to store them in cache.

how i can store them in cache in ASP.NET MVC 3. any suggetion for doing this.


David Hayden has a blog post on partial page OutputCache http://davidhayden.com/blog/dave/archive/2011/01/25/partialpageoutputcachingaspnetmvc3.aspx

And Phil Haack has an article on donut hole caching (based on an older version of MVC) http://haacked.com/archive/2009/05/12/donut-hole-caching.aspx

I don't think you want to store them in the browser cache, but rather in the server cache so you don't need the server to regenerate the content each time. Partial page caching on the client would be hard to do unless you were doing ajax calls. In that case you could cache the result from an ajax call and it would be reused by subsequent ajax calls.


You can use OutputCacheAttribute to store the return values of the controller in the web server cache. What this does is the next the controller action is invoked the cached data is returned instead of executing the method. Since you also mention you want to cache this on the client browser you might want to look at Google Gears or other solutions for that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜