javascript - 关于缓存的问题
PHP中文网
PHP中文网 2017-04-11 10:56:27
0
0
229

我用express框架做的后台,当我关闭etag,并设置maxAge时,静态资源有时候出现200 OK (from memory cache)有时候出现200 OK (from disk cache),那么这两者有什么区别吗?
还有的时候会出现Status Code:304 Not Modified,这又是怎么回事?不是应该直接从缓存里取数据,不用和服务器交互吗?

代码如下:

app.use(express.static(path.join(__dirname, 'build'), { //build文件夹是打包后的文件夹 maxAge: 86400000, etag: false }));

network下的一些信息:

1): General Request URL:http://localhost:18081/monitor/fmc/assets/js/echarts-theme.js Request Method:GET Status Code:304 Not Modified Remote Address:[::1]:18081 Response Headers Accept-Ranges:bytes Cache-Control:public, max-age=86400 Connection:keep-alive Date:Sat, 24 Dec 2016 09:54:19 GMT Last-Modified:Tue, 08 Nov 2016 11:31:47 GMT X-Powered-By:Express 2): General Request URL:http://localhost:18081/monitor/fmc/assets/images/bg-out.jpg Request Method:GET Status Code:200 OK (from memory cache) Remote Address:[::1]:18081 Response Headers Accept-Ranges:bytes Cache-Control:public, max-age=86400 Connection:keep-alive Content-Length:446462 Content-Type:image/jpeg Date:Sat, 24 Dec 2016 09:53:56 GMT Last-Modified:Sat, 26 Nov 2016 01:16:49 GMT X-Powered-By:Express
PHP中文网
PHP中文网

认证0级讲师

全員に返信 (0)
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!