`navigator.storage.persist` 祖父会将常规缓存条目变成持久缓存条目吗?

Will `navigator.storage.persist` grandfather regular cache entries into persistent ones?

如果我调用 navigator.storage.persist,已经添加到(但尚未从中删除)常规缓存的条目是否会自动持久化,或者是否必须创建一个新的缓存(例如,通过某种方式复制将旧的非持久缓存转换为新创建的(现在,给定用户权限,持久缓存)?

我想让我的应用程序尽早开始对关键文件进行定期缓存,然后请求持久性并将服务工作者注册到 install 这些文件,理想情况下无需发出任何新请求(除非用户在工作人员安装之前已经以某种方式清除了缓存)。

specification 第 3 节和第 3.1 节的以下摘录是相关的:

...Each origin has an associated site storage unit. A site storage unit contains a single box.

A box has mode which is either "best-effort" or "persistent"...

A box is considered to be an atomic unit. Whenever a box is cleared by the user agent, it must be cleared in its entirety.

因此,您的源存储有一个概念性的 "box",并且该源以全有或全无的方式被清除。这将适用于在 "box" 从 "best-effort" 转变为 "persistent" 之前或之后存储的项目。

这就是说您可以先缓存一些东西,然后再请求持久化。