# http缓存 **Repository Path**: xierge/http-cache ## Basic Information - **Project Name**: http缓存 - **Description**: 对http缓存的学习 - **Primary Language**: JavaScript - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-01-17 - **Last Updated**: 2023-01-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # http 缓存 #### 介绍 对 http 缓存的学习 ### 1.强制缓存的两种 - http1.0 expires 属性 - http2.0 cache-control : max-age = 5 ### 2.协商缓存 --- 前提 cache-control = no-cache - Last-Modified 文件修改的时间 - etag 文件编译成的一个码 ### 3.no-cache 与 no-store 的区别 - no-cache 表示直接走协商缓存,直接与服务器进行验证缓存的有效性。 - no-store 表示不采取任何缓存措施。 - 两者互斥,是 cache-control 的属性值。 ### 4.private 和 public 的区别 - 互斥属性,用来判断相应资源是否可以被代理服务器进行缓存。 - public 表示可以被代理服务器进行缓存,也可以被浏览器进行缓存。 - private 表示只可以使用浏览器缓存。 #### 安装教程 1. npm i 2. node server.js 3. 访问 http://localhost:3000/