PERF: Add more constraint on the Cache Storage usage

Only restricting cache per age wasn't enough for instances with lots of
multimedia usage and high number of posts.

MaxEntries is also more effective on cleanup, and purgeOnQuotaError
advertise that Discourse cache can be purged if necessary.

https://developers.google.com/web/tools/workbox/guides/storage-quota
This commit is contained in:
Rafael dos Santos Silva 2019-07-27 11:52:21 -03:00
parent dcb0e5f1e5
commit 1922d4bf78
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,8 @@ workbox.routing.registerRoute(
plugins: [
new workbox.expiration.Plugin({
maxAgeSeconds: 7* 24 * 60 * 60, // 7 days
maxEntries: 500,
purgeOnQuotaError: true, // safe to automatically delete if exceeding the available storage
}),
],
})