46 lines
4.4 KiB
XML
46 lines
4.4 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1120" role="img" aria-labelledby="title desc">
|
|
<title id="title">Как HTTP-кэш выбирает вариант ответа</title>
|
|
<desc id="desc">Схема показывает, что URL и поля из Vary образуют ключ варианта, затем кэш проверяет свежесть и при истечении срока валидирует ETag у origin.</desc>
|
|
<rect width="720" height="1120" fill="#f8fafc"/>
|
|
<rect x="42" y="34" width="636" height="108" rx="18" fill="#1e293b"/>
|
|
<text x="360" y="78" text-anchor="middle" fill="#fff" font-size="28" font-family="Arial, sans-serif" font-weight="700">Ответ выбирается по ключу, а не по TTL</text>
|
|
<text x="360" y="112" text-anchor="middle" fill="#cbd5e1" font-size="20" font-family="Arial, sans-serif">URL + входы, перечисленные в Vary</text>
|
|
|
|
<rect x="82" y="192" width="556" height="108" rx="16" fill="#e0f2fe" stroke="#0284c7" stroke-width="3"/>
|
|
<text x="360" y="234" text-anchor="middle" fill="#0c4a6e" font-size="25" font-family="Arial, sans-serif" font-weight="700">GET /catalog</text>
|
|
<text x="360" y="268" text-anchor="middle" fill="#0c4a6e" font-size="20" font-family="Arial, sans-serif">Accept-Language: ru</text>
|
|
<path d="M360 300v48" stroke="#334155" stroke-width="5" marker-end="url(#arrow)"/>
|
|
|
|
<rect x="82" y="352" width="556" height="132" rx="16" fill="#fef3c7" stroke="#d97706" stroke-width="3"/>
|
|
<text x="360" y="395" text-anchor="middle" fill="#78350f" font-size="25" font-family="Arial, sans-serif" font-weight="700">Ключ варианта</text>
|
|
<text x="360" y="431" text-anchor="middle" fill="#78350f" font-size="20" font-family="Arial, sans-serif">URL + Accept-Language</text>
|
|
<text x="360" y="459" text-anchor="middle" fill="#78350f" font-size="18" font-family="Arial, sans-serif">если origin отдал Vary: Accept-Language</text>
|
|
<path d="M360 484v48" stroke="#334155" stroke-width="5" marker-end="url(#arrow)"/>
|
|
|
|
<rect x="110" y="536" width="500" height="110" rx="16" fill="#ede9fe" stroke="#7c3aed" stroke-width="3"/>
|
|
<text x="360" y="578" text-anchor="middle" fill="#4c1d95" font-size="25" font-family="Arial, sans-serif" font-weight="700">Найдено представление ru</text>
|
|
<text x="360" y="612" text-anchor="middle" fill="#4c1d95" font-size="19" font-family="Arial, sans-serif">Cache-Control задаёт его свежесть</text>
|
|
<path d="M360 646v52" stroke="#334155" stroke-width="5" marker-end="url(#arrow)"/>
|
|
|
|
<rect x="80" y="702" width="254" height="116" rx="16" fill="#dcfce7" stroke="#16a34a" stroke-width="3"/>
|
|
<text x="207" y="748" text-anchor="middle" fill="#14532d" font-size="24" font-family="Arial, sans-serif" font-weight="700">Свежий</text>
|
|
<text x="207" y="781" text-anchor="middle" fill="#14532d" font-size="18" font-family="Arial, sans-serif">вернуть тело</text>
|
|
<rect x="386" y="702" width="254" height="116" rx="16" fill="#fee2e2" stroke="#dc2626" stroke-width="3"/>
|
|
<text x="513" y="748" text-anchor="middle" fill="#7f1d1d" font-size="24" font-family="Arial, sans-serif" font-weight="700">Устарел</text>
|
|
<text x="513" y="781" text-anchor="middle" fill="#7f1d1d" font-size="18" font-family="Arial, sans-serif">проверить ETag</text>
|
|
<path d="M513 818v52" stroke="#334155" stroke-width="5" marker-end="url(#arrow)"/>
|
|
|
|
<rect x="110" y="874" width="500" height="114" rx="16" fill="#e0f2fe" stroke="#0284c7" stroke-width="3"/>
|
|
<text x="360" y="916" text-anchor="middle" fill="#0c4a6e" font-size="24" font-family="Arial, sans-serif" font-weight="700">If-None-Match → origin</text>
|
|
<text x="360" y="951" text-anchor="middle" fill="#0c4a6e" font-size="19" font-family="Arial, sans-serif">304 подтверждает тело; 200 даёт новый вариант</text>
|
|
|
|
<rect x="110" y="1032" width="500" height="54" rx="14" fill="#fff7ed" stroke="#ea580c" stroke-width="3"/>
|
|
<text x="360" y="1067" text-anchor="middle" fill="#7c2d12" font-size="19" font-family="Arial, sans-serif">Неполный ключ может вернуть свежий, но чужой язык</text>
|
|
|
|
<defs>
|
|
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
|
|
<path d="M0 0L10 5L0 10z" fill="#334155"/>
|
|
</marker>
|
|
</defs>
|
|
</svg>
|