首页 > 其他分享 >[Web] Cache Directives

[Web] Cache Directives

时间:2023-06-18 17:23:29浏览次数:31  
标签:Web use cache Cache server version Directives response must

 

no-cache: validate cache as the latest one before using it.

This means that a cache should not serve a stored copy of the response without validating its freshness with the server. The response can be stored in a cache, but it must check with the server before serving it. This does not mean that the response should not be stored in cache; rather, that it should not be served from cache without checking its validity.

In the response, it contains 'ETag' in the response header which respensent the version of cache.

Using the ETag to validate wheather the cache is latest or not.

Server retrun 304 if the cache is latest

Using new cache if the ETag is out of date.

 

must-revalidate: works together with max-age, after timeout, must revalidate again

This means that once a resource becomes stale, caches must not use their stale copy without successful validation on the origin server. In other words, if the cached version is past its expiration time, the cache must check with the server if the resource has been updated. If the server has no newer version, the cached version can still be used.

Notice that:

If ETag was updated on server, but not over the max-age, which means cache is still Fresh, in this case, we can still use the cache; Only after expired time, we revalidate the cache.

 

no-store: don't use cache

This is an instruction to the cache system to not store a version of the resource for future use. Essentially, the response must be fetched from the server every time the client asks for it.

 

private: prevent caches on shared cache

This means that the response message is intended for a single user (normally the one that made the request) and must not be stored by shared caches. It's used when the response is user-specific and not the same for all users.

 

stale-while-revalidate: use cache first, while do revalidation

This is a more recent addition to the caching directives, and is not universally supported. When a cache uses this directive, it can serve a stale (i.e., past its expiration date) response while it revalidates it in the background, thus improving performance and response time to the client.

It also get a timing, if expired, then do the fetch again before use it, like must-revalidate.

标签:Web,use,cache,Cache,server,version,Directives,response,must
From: https://www.cnblogs.com/Answer1215/p/17489368.html

相关文章

  • [Web] PerformanceNavigationTiming
     https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming DNSdomainLookupStartdomainLookupEndTCP/TLSconnectStartsecureConnectionStartconnectEndHTTPRequestrequestStartHTTPResponseresponseStartresponseEndP......
  • SpringBoot:SpringWeb项目+Vue项目dist包整合成jar包
    接到需求做一个小功能项目,其中还要配备前端页面,并且将前端打包进后端jar包内,由jar包运行。项目结构将Vue打包之后的dist文件放到resouces资源路径下修改pom文件将下面的build配置替换掉pom中的build<build><finalName>自定义项目jar名称(可以用${project.artifatId})</finalNam......
  • Hive扩展之web界面:hwi接口
    HWI是HiveWebInterface的简称,是hivecli的一个web替换方案,以开发的网页形式查看数据切换用户启动集群[root@master~]#su-hadoopLastlogin:TueMay213:18:34CST2023onpts/0[hadoop@master~]$start-all.shThisscriptisDeprecated.Insteadusestart-dfs.......
  • java web模板学习+1
    今天找到一个模板很厉害,代码开源的,拔下来就能跑。下面是他的博客地址和他的源代码地址。博客地址:开源一套简单通用的后台管理系统-huanzi-qch-博客园(cnblogs.com)开源地址:https://gitee.com/huanzi-qch/base-admin......
  • UniGui web客户端与本地exe通讯
     原文地址......
  • java web模板学习
    经过建民老师几次测验我发现我是真写不完那个web系统项目,然后如果真的打分的话,不会很高。所以接下来时间我要学习一些javaweb模板。这个模板吧主要是基于springboot的系统模板。我学习一下,等下次测验就可以快点。......
  • vue3+vite+web3.js报错ReferenceError: process is not defined
    在vite最新版本中使用web3会报错只需要在vite.config.ts添加如下代码即可解决报错import{fileURLToPath,URL}from'node:url'import{defineConfig}from'vite'importvuefrom'@vitejs/plugin-vue'//引入import{resolve}from'path'export......
  • 靶机2020web隐藏信息探索
     个人感觉这套做题法是非常快的,本文可能有点啰嗦,请各位务必耐心看完,相信看完的各位一定会有所学成! #绿色字体代表解析,红色字体是答案,橙色代表方法一,通过本地PC中渗透测试平台Kali对服务器场景Web20200529中的网站进行访问,找到登录界面中的FLAG,并将FLAG提交直接在url里面输入靶机I......
  • 去除IOS下默认样式-webkit-appearance
    ​html标签在不同的浏览器中会展示出不同的风格样式,这也是前端程序员所遇到的最常见的兼容问题,同时不同的浏览器对于边距的设置也不尽相同。这种情况下一般会使用reset.css进行样式重置。在不同设备上,对于标签的样式也有不同得风格,比如iPhone上input不同类型就有与Android具有......
  • JavaWeb
    review:1.post提交方式下的设置编码,防止中文乱码request.setCharacterEncoding("utf-8");get提交方式,tomcat8开始,编码不需要设置tomcat8之前,get方式设置比较麻烦:Stringfname=request.getParameter("fname");byte[]bytes=fname.getBytes("iso-8859-1");fn......