javascript - How to change TTL when using swr in Nuxt 3? (per-route preferably) - Stack Overflow

The Nuxt 3 documentations says that swr enables a static build, that lasts for a configurable TTL, howe

The Nuxt 3 documentations says that swr enables a static build, that lasts for a configurable TTL, however, nowhere was I able to find how exactly one would change the TTL & whether it can be set per-route. Is that possible? If so, how?

I've looked at github & also tried to find it in Vite / Nitro documentation but didn't find anything.

I found something about image TTL in Nitro config source files but I suppose that's not what I was looking for.

The Nuxt 3 documentations says that swr enables a static build, that lasts for a configurable TTL, however, nowhere was I able to find how exactly one would change the TTL & whether it can be set per-route. Is that possible? If so, how?

I've looked at github & also tried to find it in Vite / Nitro documentation but didn't find anything.

I found something about image TTL in Nitro config source files but I suppose that's not what I was looking for.

Share Improve this question edited Dec 7, 2022 at 7:47 Matej asked Dec 7, 2022 at 7:46 MatejMatej 2717 silver badges24 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

After some investigation & experimenting, I found out that it is possible to adjust the TTL already! You just set it to an integer value instead of a boolean.

export default defineNuxtConfig({
    routeRules: {
        '/**': { swr: 5  }, // 

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745645534a4637947.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信