m_andrasch
Question about how to use getCachedData properly (server-side)
Hey everyone,
I recently saw "Nuxt 3.8 - Client-side caching with getCachedData ✨" by Alexander Lichter https://www.youtube.com/watch?v=aQPR0xn-MMk
I have three questions about it, couldn't find in the docs.
1. Where is this cached data stored - in RAM server-side?
2. When is this data cleared if I use
default
? Or only if I restart nuxt?
Use case in my project:
- Footer.vue file --> lazyFetch() to /nuxt/server/api/get-footer-data.ts (server-side)
- /nuxt/server/api/get-footer-data.ts --> retrieves data from REST API from CMS
- best case scenario is that all calls happen server-side, no need for client-side fetching
3. For server/api/get-footer-data.ts endpoint, I implemented redis caching to cache the REST API calls, add http cache control headers, TTL, etc. => is it a good choice to use getCachedData + other caching solutions?
Thanks very much for any pointers!
Cheers, Matthias5 replies