N
Nuxt2y ago
Gary

Nitro routeRules shouldInvalidateCache

Not sure I understand how or why but from Nuxt nuxt.config.ts why do the shouldInvalidateCache and shouldBypassCache functions not work? If I do the following:
nitro: {
routeRules: {
'/**': {
cache: {
swr: true,
maxAge: 60 * 60,
shouldInvalidateCache: () => true,
shouldBypassCache: () => true,
},
},
},
},
nitro: {
routeRules: {
'/**': {
cache: {
swr: true,
maxAge: 60 * 60,
shouldInvalidateCache: () => true,
shouldBypassCache: () => true,
},
},
},
},
<script setup lang="ts">
const time = new Date().getTime()
</script>

<template>
{{ time }}
</template>
<script setup lang="ts">
const time = new Date().getTime()
</script>

<template>
{{ time }}
</template>
Time never updates until the maxAge expires. I would imagine that cache would be invalidated every time the page loaded.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server