> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/http/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/http/http-2-1/undefined-1.md).

# 캐시와 조건부 요청 헤더

* **Cache**-**Control**: **캐시 제어(캐시 지시어 directives)**\
  max-age : 캐시 유효 시간, 초 단위\
  no-cach : 데이터는 캐시해도 되지만, 항상 원(origin) 서버에 검증하고 사용!\
  no-store : 데이터에 민감한 정보가 있으므로 저장하면 안 됨!!!\
  &#x20;            (보통 캐시는 하드디스크에 저장되지만, 메모리에서 사용하고 최대한 빨리 삭제)
* **Pragma**: **캐시 제어(하위 호환)**\
  Pragma: no-cach\
  HTTP 1.0 하위호환
* **Expires**: **캐시 유효 기간(하위 호환)**\
  캐시 만료일을 정확한 날짜로 지정 ex) expires: Mon, 01 Jan 1990 00:00:00 GMT\
  HTTP 1.0 부터 사용\
  지금은 더 유연한 Cache-Control: max-age 권장\
  **Cache-Control: max-age**와 **함께 사용**하면 **Expires는 무시**

검증 헤더(클라이언트 측에서 검증)\
Last-Modified, ETag

조건부 요청 헤더\
if-Modified-Since, if-Unmodified-Since : Last-Modified 값 사용\
if-None-Match, if-Match : ETag 값 사용
