Add more purges and don't cache too long

This commit is contained in:
Lim Chee Aun 2024-09-17 17:16:12 +08:00
parent f1e4ea2cfc
commit f59058efa1

View file

@ -45,7 +45,6 @@ const imageRoute = new Route(
plugins: [ plugins: [
new ExpirationPlugin({ new ExpirationPlugin({
maxEntries: 50, maxEntries: 50,
maxAgeSeconds: 3 * 24 * 60 * 60, // 3 days
purgeOnQuotaError: true, purgeOnQuotaError: true,
}), }),
new CacheableResponsePlugin({ new CacheableResponsePlugin({
@ -88,6 +87,7 @@ const apiExtendedRoute = new RegExpRoute(
plugins: [ plugins: [
new ExpirationPlugin({ new ExpirationPlugin({
maxAgeSeconds: 24 * 60 * 60, // 1 day maxAgeSeconds: 24 * 60 * 60, // 1 day
purgeOnQuotaError: true,
}), }),
new CacheableResponsePlugin({ new CacheableResponsePlugin({
statuses: [0, 200], statuses: [0, 200],
@ -129,6 +129,7 @@ const apiRoute = new RegExpRoute(
plugins: [ plugins: [
new ExpirationPlugin({ new ExpirationPlugin({
maxAgeSeconds: 5 * 60, // 5 minutes maxAgeSeconds: 5 * 60, // 5 minutes
purgeOnQuotaError: true,
}), }),
new CacheableResponsePlugin({ new CacheableResponsePlugin({
statuses: [0, 200], statuses: [0, 200],