zoukankan      html  css  js  c++  java
  • 服务器缓存不依赖URL的方法(OutPutCache)及客户端不缓存,完美做法

    可以避免客户端缓存:

    <%Response.Cache.SetNoStore();%>

    ----------------------------------------------------------------------------------------------------------------------

    经过测试,下面的方式会清空服务器端的缓存。不适合配合Global.asax使用

    <% Response.CacheControl = "no-cache" %>
    <% Response.AddHeader "Pragma", "no-cache" %>
    <% Response.Expires = -1 %>s

    ----------------------------------------------------------------------------------------------------------------------

    又或者在OutPutCache时  Location="Server" 也是可以的,建议这种。

    ----------------------------------------------------------------------------------------------------------------------

    服务器缓存方式:

    Global.asax:

    新增函数:

       public override string GetVaryByCustomString(HttpContext context, string custom)
            {
                if ("Student".Equals(custom))
                {
                    return string.Format("{0}", "动态数据");
                }
                return base.GetVaryByCustomString(context, custom);
            }

    页面:

      <%@ OutputCache Duration="180" VaryByCustom="Student" VaryByParam="none"  %>

  • 相关阅读:
    07_zookeeper的客户端工具curator_基本api
    06_zookeeper原生Java API使用
    05_zookeeper的ACL
    04_zookeeper的watcher机制
    03_Zookeeper基本数据模型及基本命令操作
    02_zookeeper配置
    01_Zookeeper简述
    thinkphp之url的seo优化
    thinkphp Upload上传文件在客户端生成的临时文件$_FILES['file']['tmp_name']
    php过滤表单输入的emoji表情
  • 原文地址:https://www.cnblogs.com/dachie/p/2024602.html
Copyright © 2011-2022 走看看