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

View File

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