SlideShare a Scribd company logo
Caching in HTTP
SJ
2013/07/25
Email: sj@toright.com
Blog: http://blog.toright.com
回顧 HTTP 1.1 的設計理念
Architectural Styles and the Design of Network-based Software Architectures (by Roy Thomas
Fielding)
CHAPTER 5. Representational State Transfer (REST)
HTTP Features
● HTTP 1.1 設計 Cache 的目的在降低
Request 與 Full Response
● 以下兩個主要的設計理念
○ Expiration
○ Validation
● 實作上透過 Header 讓 Server 與 Client 可以
自由定義 Cache 的方式
HTTP 1.0 與 HTTP 1.1 Caching Difference
HTTP 1.0 Reponse Cache Header
○ Expires
○ Pragma
HTTP 1.1 Reponse Cache Header
○ Cache-Control
介紹 HTTP 1.1 Cache-Control Header
● Response Cache Header
○ no-store
完全不 Cache
○ no-cache
允許 Cache 但是每次都會檢查 Cache 狀態
○ max-age
設定要 Cache 幾秒
○ private
Cache 只給目前使用者使用
○ public
Cache 可共用 (HTTPS不可共用)
○ must-revalidate
交由 Client 自行決定要不要使用Cache
● 可以混搭
如何檢查 Cache 是否有效?
● 時間導向 (秒為單位)
Last-Modified / If-Modified-Since
● 檔案內容導向 (Hash)
ETag / If-None-Match
Cache-Control: no-store
Cache-Control: no-cache
Cache-Control: max-age
Cache-Control: private
Cache-Control: public
Cache-Control: must-revalidate
Reference
● HTTP 1.1 RFC 2616 - 14.9 Cache-Control
● HTTP 1.1 RFC 2616 - 13 Caching in HTTP
● Architectural Styles and the Design of
Network-based Software Architectures - 5
Representational State Transfer (REST)
Thanks!
The End
Email: sj@toright.com
Blog: http://blog.toright.com

More Related Content

PDF
一个 Mongodb command 的前世今生
dennis zhuang
 
PPTX
QCon - 一次 Clojure Web 编程实战
dennis zhuang
 
PDF
Http 缓存
Weiwei Wang
 
PDF
SRE讀書會-Continuous Delivery Chaper 9
Freddy Fan
 
PDF
搶救資料庫效能大作戰
Rico Chen
 
PPT
Sql server 交易機制與 log
LearningTech
 
PDF
Python小团队不妨知道的技术
jie.wang
 
PDF
基于Tornado后端系统架构暨最佳实践
ZY Zhang
 
一个 Mongodb command 的前世今生
dennis zhuang
 
QCon - 一次 Clojure Web 编程实战
dennis zhuang
 
Http 缓存
Weiwei Wang
 
SRE讀書會-Continuous Delivery Chaper 9
Freddy Fan
 
搶救資料庫效能大作戰
Rico Chen
 
Sql server 交易機制與 log
LearningTech
 
Python小团队不妨知道的技术
jie.wang
 
基于Tornado后端系统架构暨最佳实践
ZY Zhang
 

What's hot (11)

PPT
20081128 http caching_in_php
Hunter Wu
 
PDF
统一接入的架构思考
yang bingwu
 
KEY
How svn work_and_how_to_use
Bin Feng
 
PDF
JobTracker Memory Leak Solution
jiang yu
 
PPTX
前端性能测试
tbmallf2e
 
PPTX
Track2 -刘继伟--openstack in gamewave
OpenCity Community
 
PPT
使用Nginx轻松实现开源负载均衡
cachowu
 
PDF
基于OpenResty的百万级长连接推送
OpenRestyCon
 
PPT
Build scalable microblog qcon beijing 2010
Tim Y
 
PDF
大数据时代feed架构 (ArchSummit Beijing 2014)
Tim Y
 
PPTX
NODEjs Lesson1
3dmodeldiy
 
20081128 http caching_in_php
Hunter Wu
 
统一接入的架构思考
yang bingwu
 
How svn work_and_how_to_use
Bin Feng
 
JobTracker Memory Leak Solution
jiang yu
 
前端性能测试
tbmallf2e
 
Track2 -刘继伟--openstack in gamewave
OpenCity Community
 
使用Nginx轻松实现开源负载均衡
cachowu
 
基于OpenResty的百万级长连接推送
OpenRestyCon
 
Build scalable microblog qcon beijing 2010
Tim Y
 
大数据时代feed架构 (ArchSummit Beijing 2014)
Tim Y
 
NODEjs Lesson1
3dmodeldiy
 
Ad

Viewers also liked (8)

PDF
小猴子也會的 Ubuntu Desktop 14.04 安裝教學
家弘 周
 
PDF
SEO 武林天下
家弘 周
 
PDF
敏捷開花那些小事
家弘 周
 
PDF
The Clean Coder - 預估與壓力 (書摘)
家弘 周
 
PPTX
Http Headers 與 Cache 機制(2016)
振揚 陳
 
PDF
軟體品質與持續整合
家弘 周
 
PDF
MOPCON 2015 - 軟體、測試、程式設計家
家弘 周
 
PDF
REST to RESTful Web Service
家弘 周
 
小猴子也會的 Ubuntu Desktop 14.04 安裝教學
家弘 周
 
SEO 武林天下
家弘 周
 
敏捷開花那些小事
家弘 周
 
The Clean Coder - 預估與壓力 (書摘)
家弘 周
 
Http Headers 與 Cache 機制(2016)
振揚 陳
 
軟體品質與持續整合
家弘 周
 
MOPCON 2015 - 軟體、測試、程式設計家
家弘 周
 
REST to RESTful Web Service
家弘 周
 
Ad

More from 家弘 周 (9)

PDF
LLM RAG 擷取增強生成介紹 - 3 種 RAG/Self-RAG/CRAG 全解析
家弘 周
 
PDF
NVIDIA Omniverse Kit Introduction and IoT Application
家弘 周
 
PDF
2020 MLaaS 產業介紹.pdf
家弘 周
 
PDF
用 Keras 玩 Machine Learning
家弘 周
 
PDF
Linux Container Introduction
家弘 周
 
PDF
Cloud Foundry Introduction
家弘 周
 
PDF
區塊鏈共識機制與 EOS
家弘 周
 
PPTX
簡單線性回歸 & K-Means (Machine learning)
家弘 周
 
PDF
WordPress Blog SEO 兩三事
家弘 周
 
LLM RAG 擷取增強生成介紹 - 3 種 RAG/Self-RAG/CRAG 全解析
家弘 周
 
NVIDIA Omniverse Kit Introduction and IoT Application
家弘 周
 
2020 MLaaS 產業介紹.pdf
家弘 周
 
用 Keras 玩 Machine Learning
家弘 周
 
Linux Container Introduction
家弘 周
 
Cloud Foundry Introduction
家弘 周
 
區塊鏈共識機制與 EOS
家弘 周
 
簡單線性回歸 & K-Means (Machine learning)
家弘 周
 
WordPress Blog SEO 兩三事
家弘 周
 

Caching in HTTP