My app is designed to work offline, so I am using the freshness strategy. However, there are some areas that could be improved with caching while online.
I have specified that certain repeated calls to the API should use the performance strategy. This works except that after an hour offline, those files disappear and the app stops working.
Is there a simple way to keep the performance strategy files available after their expiry, so they can be still accessed offline? They may be old, but they will do when nothing else is available.
Its a catch 22 - I cannot optimise without losing the offline mode.
Basically, I want to have data less than an hour old when online, but offline I am happy with any data up to a week old.
My ngsw-config.json
"dataGroups": [
{
"name": "optimise",
"urls": [
"https://**/optimise.php"
],
"cacheConfig": {
"strategy": "performance",
"maxSize" : 250,
"maxAge" : "1h"
}
},
{
"name": "offline",
"urls": [
"https://**/offline.php"
],
"cacheConfig": {
"strategy": "freshness",
"maxSize" : 250,
"maxAge" : "7d",
"timeout" : "15s"
}
}
]