# 캐시 무효화

캐시를 적용하지 않는다면 캐시가 안 되는 것 아닌가?\
캐시를 적용하지 않아도 웹 브라우저에서 GET 요청일 때 임의로 캐시를 요청하기도 한다.

이 페이지는 진짜 캐시가 되면 안 되는 경우!!\
ex) 통장 잔고 : 잔고는 계속 바뀌기 때문에 캐시가 되면 안 된다!\
**Cache-Control : no-cache, no-store, must-revalidate**\
**Pragma: no-cache**\
HTTP 1.0에서 요청이 올지도 모르기 때문에!

Cache-Control\
캐시 지시어(directives) - 확실한 캐시 무효화

* Cache-Control: **no-cache**\
  데이터는 캐시에 저장하고 써도 되지만, **항상 원 서버에 검증하고 사용**(이름에 주의!)
* Cache-Control: no-store\
  데이터에 민감한 정보가 있으므로 저장하면 안됨\
  (메모리에서 사용하고 최대한 빨리 삭제)
* Cache-Control: **must-revalidate**\
  **캐시 만료후** **최초 조회시 원 서버에 검증해야함**\
  **원 서버 접근 실패시 반드시 오류가 발생해야함 - 504(Gateway Timeout)=>no-cache와 차이점**\
  **캐시 유효 시간이라면 캐시를 사용함**
* Pragma: no-cache : HTTP 1.0 하위 호환

**no-cache와 must-revalidate 차이점**

![no-cache](/files/-Mdpo7oXegpEAHmSPVoJ)

![must-revalidate](/files/-MdpoBEmJyruUAHoR4Td)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://heunnajo.gitbook.io/http/http-2-1/undefined-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
