當用戶首次訪問網站,瀏覽器從服務器下載所有資源;再次訪問時,若資源未過期,瀏覽器直接從本地緩存讀取,實現「秒開」體驗。大型門戶(網易、搜狐、2345導航等)均廣泛啟用此功能。
內容更新頻率可控的站點:企業官網、博客、導航站、靜態資源庫、API 接口(配合版本號)。不適用:高頻實時數據(股票、即時通訊)、用戶個性化頁面。

Cache-Control 值:public, max-age=43200(12小時)Expires 絕對時間。Cache-Control: max-age=43200 或 Expires: ...200 (from disk cache) 或 200 (from memory cache),Size 顯示 from disk cache。Cache-Control 字段。
IIS 6 僅支持整站/目錄級別統一過期時間。IIS 7+ 可通過 web.config 實現精細控制:
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="100.00:00:00" /> <!-- 圖片等靜態文件 100 天 -->
</staticContent>
<caching>
<profiles>
<add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="3.00:00:00" />
<add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="3.00:00:00" />
</profiles>
</caching>
</system.webServer>
</configuration>
style.v20240101.css),或手動清理瀏覽器緩存。Cache-Control: no-store, must-revalidate。「內容過期」是零成本、高收益的性能優化銀彈。花 1 分鐘配置,換來用戶「秒開」體驗與服務器負載驟降,何樂而不為?立即打開 IIS 管理器,為您的網站加上這道「加速鎖」吧!