I have a SvelteKit landing page component that calculates and displays statistics. Because crunching the numbers out from the database is a heavy job, and this information updates only around an hour or so, I would like to cache the result so that the landing page will be served fast for all the visitors. The statistics are loaded from the backend using a fetch()
during route load()
.
I am using SvelteKit server-side rendering for the page, with Node.js adapter. I can have SvelteKit to connect to SQL, Redis or something else to store the result of caching. I believe even a file-system based cache would work in my case.
Do Svelte and SvelteKit support any kind of server-side rendering caching options that make sense in my use case? E.g. instead of rendering the component, the component would cache the load()
input or even the generated HTML. Are there libraries or caching solutions that are well-known in Svelte world and integrate well with Svelte?