0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

キャッシュとは

Posted at

キャッシュとは

キャッシュとは、Webサーバから取得したリソース(断片的なデータ、ファイル、機能など)のこと。また、リソースを保存してある場所。また、リソースを保存するための技術。

ブラウザがリクエストしたとき、リクエスト内容のキャッシュが保存されていると、Webサーバからではなく、近くにあるキャッシュからリソースを取得する。そのため、通信速度を高速化できる。

一方、キャッシュが残り続けると、リソースの更新が反映されず、ユーザに適切なリソースを返せないことがある。
そのため、キャッシュを長時間保存することは推奨されない。

Cache-Controlヘッダフィールド

Cache-Controlヘッダフィールドは、キャッシュの制御を行う。例えば、no-styleを設定すると、ブラウザやWebサーバでキャッシュが保存されなくなる。
また、max-ageを指定すると、キャッシュの有効期限を秒単位で指定できる。

Expiresヘッダフィールド

Expiresヘッダフィールドは、レスポンスの有効期限を指定する。
Cache-Controlヘッダフィールドと異なり、有効期限は日付形式で指定する。
ただし、Cache-Controlヘッダフィールドでmax-ageの指定がされている場合、Expiresヘッダフィールドは無視される。

Ageヘッダフィールド

Ageヘッダフィールドは、プロキシサーバ(中継サーバ)にキャッシュする期限を指定する。キャッシュ期限は秒数で指定する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?