[英]how i can use cache in client side browser?
i have a website who have a list of information 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. 我如何将它们存储在ASP.NET MVC 3的缓存中。执行此操作的任何建议。
You can use OutputCacheAttribute to store the return values of the controller in the web server cache. 您可以使用OutputCacheAttribute将控制器的返回值存储在Web服务器缓存中。 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.
由于您也提到要在客户端浏览器上缓存它,因此您可能需要查看Google Gears或其他解决方案。
David Hayden has a blog post on partial page OutputCache http://davidhayden.com/blog/dave/archive/2011/01/25/partialpageoutputcachingaspnetmvc3.aspx David Hayden在部分页面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 菲尔·哈克(Phil Haack)则发表了一篇关于甜甜圈孔缓存的文章(基于旧版本的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.
除非进行ajax调用,否则很难在客户端上进行部分页面缓存。 In that case you could cache the result from an ajax call and it would be reused by subsequent ajax calls.
在这种情况下,您可以缓存来自ajax调用的结果,并且随后的ajax调用将重用该结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.