asp.net-mvc – ASP.NET MVC – 在客户端缓存页面

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – ASP.NET MVC – 在客户端缓存页面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有这样缓存的代码
[OutputCache(Duration="3600",Location=OutputCacheLocation.Client)]

现在,我不知道这个输出缓存是如何工作的.它究竟在哪里保留页面的副本? OutputCacheLocation.Client和OutputCacheLocation.Browser之间有什么区别?

解决方法

Where exactly does it keep the copy of a page?

存储高速缓存的位置由OutputCacheAttribute的Location属性确定.在您的情况下,您设置Location = OutputCacheLocation.Client,以便它将缓存保留在客户端浏览器上.

And what are the differences between OutputCacheLocation.Client and
OutputCacheLocation.Browser?

OutputCacheLocation.Browser不存在.这是一个无效的价值. OutputCacheLocation枚举类型的文档包含可能的值及其用法说明:

  • Any – The output cache can be located on the browser client (where the request originated),on a proxy server (or any other server)
    participating in the request,or on the server where the request was
    processed. This value corresponds to the HttpCacheability.Public
    enumeration value.
  • Client – The output cache is located on the browser client where the request originated. This value corresponds to the
    HttpCacheability.Private enumeration value.
  • Downstream – The output cache can be stored in any HTTP 1.1 cache-capable devices other than the origin server. This includes
    proxy servers and the client that made the request.
  • Server – The output cache is located on the Web server where the request was processed. This value corresponds to the
    HttpCacheability.Server enumeration value.
  • None – The output cache is disabled for the requested page. This value corresponds to the HttpCacheability.NoCache enumeration value.
  • ServerAndClient – The output cache can be stored only at the origin server or at the requesting client. Proxy servers are not allowed to cache the response. This value corresponds to the combination of the HttpCacheability.Private and HttpCacheability.Server enumeration values.
原文链接:https://www.f2er.com/aspnet/251262.html

猜你在找的asp.Net相关文章