加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 00:01:10 所属栏目:asp.Net 来源:网络整理
导读:我有这样缓存的代码: [OutputCache(Duration="3600",Location=OutputCacheLocation.Client)] 现在,我不知道这个输出缓存是如何工作的.它究竟在哪里保留页面的副本? OutputCacheLocation.Client和OutputCacheLocation.Browser之间有什么区别? 解决方法 Whe
我有这样缓存的代码:
[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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读