キャッシュ

キャッシュ (Web)

[4] キャッシュ (cache) は、 ネットワーク経由で取得したデータを一時的に保持しておき、 以後のアクセスでネットワークアクセスを省略するものです。 Web においては利用者エージェントで用いられています。

仕様書

HTTP キャッシュ

[6] キャッシュとは、以前の応答メッセージ局所的に蓄積するもの (local store) 、 およびそのメッセージ蓄積域と取得や削除を制御する部分システムのことをいいます。 キャッシュは、キャッシュ可能応答を蓄積して、 以後の等価な要求の応答時間やネットワーク帯域の消費を節減するものです。 >>5

[7] クライアントは、キャッシュを用いて構いません >>5, >>11キャッシュの実装は必須ではありませんが、特に要件や設定がない限り、 キャッシュした応答を使うのは好ましいことと考えられています >>11

[8] トンネルとして動作しているときは、キャッシュを使うことはできません。 >>5, >>11

[21] キャッシュを実装する場合でも、キャッシュ応答蓄積することや、 蓄積された応答を使って返答することは必ずしも求められていません。 HTTP の仕様ではキャッシュを使ってはいけない場面は規定されていますが、 使わなければならない状況はありません。

[22] 著者キャッシュの有無や実装方法に依存したスクリプトなどを書くことは不可能ではありませんが、 一般的には、キャッシュされるべきでない場面で意図せずキャッシュされて問題が起こることはあっても、 キャッシュするべきなのにされなくて問題が起こることはあまりありません。 キャッシュする場合にどう動作するかは標準化する必要があっても、 いつキャッシュしなければならないかは相互運用性に然程影響するとは思えませんし、 そもそもキャッシュが実装されないこともありますから、意味が無いのでしょう。

[20] キャッシュに蓄積するデータの単位をキャッシュ項目と呼んでいます。 キャシュ項目はおおよそ URL要求メソッドに対応するものです。

[23] HTTP応答にはキャッシュ可能なものとそうでないものがあり、 キャッシュ可能なものは、キャッシュ蓄積することができます。 キャッシュ蓄積したものを応答に使う (再利用する) かどうかは、 更にいくつかの条件があります。

[15] キャッシュには、共有キャッシュ私的キャッシュがあります。 私的キャッシュにはキャッシュ可能応答でも、 共有キャッシュにはキャッシュ可能でないことがあります。

[24] 詳しくは次の各項目を参照してください。

履歴

[17] Webブラウザーは普通キャッシュを持っています。

[18] navigate などで使われるのは HTTPキャッシュ (私的キャッシュ) と思われます。

[19] 履歴探索では、 HTTPキャッシュなら有効期限切れとなっているような応答が再利用されることがあります。また履歴探索の場合には応答だけでなく、 pushState によって関連付けられたデータや bfcache により保存された実行環境などが使われることがあります。

その他のキャッシュ

[12] WebブラウザーAppCache も実装していることがあります。

[13] は、アプリケーション依存の様々なキャッシュを利用していることがあります。 HTTP に従っているキャッシュ串の他、特定アプリケーション向けの HTTP に厳密には適合しないキャッシュ串や、 memcached などのキャッシュプログラミング言語ライブラリーの機能を利用したキャッシュなど、 様々な仕組みが用いられています。

[14] これら内部のキャッシュHTTP を通じてクライアント側からは直接的には観測できないのが普通なので、 アプリケーションの性質に応じて自由な仕組みと構成を採用できます。

[35] HSTSRFC では、何箇所かだけ既知HSTSホスト情報のことを 「キャッシュ」と言っています。

[36] PKPRFC では、既知ピン付きホストの情報のことを 「キャッシュ」と言っています。

[37] その他、実装によっては favicon など機能独自のキャッシュ機構があるかもしれません。

歴史

[1] HTTP (RFC1945 1.2, RFC2068 1.3, RFC2616 1.3)
cache
A program's local store of response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable {2616} responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server may include a cache, though a cache cannot be used by a server while it {2068,2616} that is acting as a tunnel.
キャッシュ
プログラムの、応答メッセージの局所蓄積及びこのメッセージ蓄積, 取り出し, 削除を制御する部分システム。 キャッシュは、以後の同等の要求応答時間とネットワーク帯域消費を削減するためにキャッシュ可能応答を蓄積します。 任意のクライアント又はサーバーはキャッシュを含んでも構いません。 但しトンネルとして動作しているサーバーはキャッシュを使うことはできません。

[2] Early findings: Mobile browser cache persistence and behaviour ( ( 版)) http://www.webperformancetoday.com/2012/07/12/early-findings-mobile-browser-cache-persistence-and-behaviour/

[3] RFC 3143 - Known HTTP Proxy/Caching Problems ( ( 版)) http://tools.ietf.org/html/rfc3143

[9] [whatwg] Image cache behaviour ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-June/036351.html

[10] Web Applications 1.0 r7128 Try to define img synchronous loading. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7127&to=7128

[16] Add cache mode concept and elaborate a bit on caching. · 99377cd · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/99377cd334e7e4e7737c2b2fd521c74a6cf7e01a

[25] Turn request's cache mode into six modes per https://github.com/slightly... · 606ef84 · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/606ef84364515f932570068e9026d2d535846a74

[26] Deal with partial cache entries https://github.com/slightlyoff/ServiceWo... · 10cceb6 · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/10cceb6ec1cf04456ac6ff66917ebc509ca5181b

[27] Add cache mode API for https://github.com/slightlyoff/ServiceWorker/issu... · a2bd3aa · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/a2bd3aaadaf507c8ea7b3992d488a84d14b43470

[28] Draft for cache state for https://github.com/slightlyoff/ServiceWorker/i... · fef58a7 · whatwg/fetch ( ( 版)) https://github.com/whatwg/fetch/commit/fef58a71c053533460a5ef81683acaf7006e9f80

[29] Frecency algorithm - Mozilla | MDN ( 版) https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Frecency_algorithm

[30] Necko/Cache - MozillaWiki ( 版) https://wiki.mozilla.org/Necko/Cache

[31] Necko/Differences - MozillaWiki ( 版) https://wiki.mozilla.org/Necko/Differences

Chrome does heuristic cache validation for resources with query strings in their URI; we do not.

MSIE requires that a successful connection to the server be made before it will use an HTTPS cache entry; we do not. I don't know what Chrome does here.

[32] Part2 - browsersec - Browser Security Handbook, part 2 - Browser Security Handbook - Google Project Hosting ( 版) https://code.google.com/p/browsersec/wiki/Part2#Document_caching

[33] Caching Tutorial for Web Authors and Webmasters ( 版) https://www.mnot.net/cache_docs/

[34] IRC logs: freenode / #whatwg / 20150529 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20150529

I read about one-time possible privacy attack allowing to discover, what sites user visited. The idea is to measure time of loading favucon.ico from various sites. If it is in a cache, it will load sifnificantly faster. What you think?

# [14:23] <IZh> And the time could be compared with favicon.ico?someRandomValue

[38] RFC 3040 - Internet Web Replication and Caching Taxonomy ( 版) https://tools.ietf.org/html/rfc3040

[39] HttpCacheReadBehavior enumeration - Windows app development ( 版) https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.filters.httpcachereadbehavior.aspx

[40] Disk Cache - The Chromium Projects ( 版) https://www.chromium.org/developers/design-documents/network-stack/disk-cache

[41] W3M FAQ ( ()) http://homepage2.nifty.com/aito/w3m/FAQ.html

他の多くのブラウザと違い,w3mはキャッシュを持っていません. そのため,文書を読むたびにWWWサーバから文書を転送します.もし可能なら, キャッシュサーバを利用すると快適です.設定はプロキシの設定と同じです.

[42] 660749 – (CVE-2011-0082) Firefox doesn't (re)validate certificates when loading a HTTPS page from the cache ( ()) https://bugzilla.mozilla.org/show_bug.cgi?id=660749

[43] Matching hint responses with requests · Issue #5 · igrigorik/resource-hints ( ()) https://github.com/igrigorik/resource-hints/issues/5

[44] Matching hint responses with requests · Issue #2 · w3c/resource-hints ( ()) https://github.com/w3c/resource-hints/issues/2

[45] Rewrite HTTP cache integration (mnot著, ) https://github.com/whatwg/fetch/commit/cbca2c2f3a37084e336e14348de683f8ffa0fed9

[46] For users on very slow connections, block document.written scripts · Issue #17 · WICG/interventions () https://github.com/WICG/interventions/issues/17

[47] Added a cache performance warning. (#44) (msramek著, ) https://github.com/w3c/webappsec-clear-site-data/commit/681f03fe52725a40992d59831f492822c152e66b

[48] Added a cache performance warning. by msramek · Pull Request #44 · w3c/webappsec-clear-site-data () https://github.com/w3c/webappsec-clear-site-data/pull/44

[49] Add response's cache state back (annevk著, ) https://github.com/whatwg/fetch/commit/6702eefda313e06bca0525745b72b0870e6fd2b9

[50] HTCP

[51] RFC 3040 - Internet Web Replication and Caching Taxonomy, , https://tools.ietf.org/html/rfc3040