将 Angular 5 PWA 缓存时间设置为无限制

Setting Angular 5 PWA Caching Time to unlimited

我的 pwa(Progressive Web App) 的缓存在 3 天后被删除。有没有办法告诉浏览器永远不应该删除缓存?

我的 ngsw-config.json 看起来像这样:

{
    ...
    "dataGroups": [{
            "name": "api-freshness",
            "urls": [
                "/timeline"
            ],
            "cacheConfig": {
                "strategy": "freshness",
                "maxSize": 100,
                "maxAge": "3d",
                "timeout": "10s"
            }
        },
        {
            "name": "api-performance",
            "urls": [
                "/favorites"
            ],
            "cacheConfig": {
                "strategy": "performance",
                "maxSize": 100,
                "maxAge": "3d"
            }
        }
    ]
}

我能以某种方式将 maxAge 设置为无限制吗?

需要输入类似于3d12hdocumentation specifies that maxAge is required and it's parsed using a method。但是,您可以使用 365d 之类的值,出于所有实际目的,它将是 "unlimited".