`title: Cache 清单与一致性校验打点实践``categories: Web 开发/前端/数据管理``keywords: Cache Storage,清单,校验,打点,一致性``description: 维护缓存清单并对关键资源进行一致性校验与打点,结合 SRI/ETag 与 SW 协作保障稳定性。`清单打点async function auditCache(name = 'static-v2') { const c = await caches.open(name); const keys = await c.keys(); const out = []; for (const k of keys) { const r = await c.match(k); out.push({ url: k.url, size: (await r.clone().arrayBuffer()).byteLength }); } return out; }

发表评论 取消回复