SSR long lived cache
Hi! i just want the page data to be cached on the server with a tag that i can re-validate, with no expiration
i'm using Neon as database and every request to the database takes a couple of seconds. so for the blogs posts, each time you visit there's a waiting time.
compare to next.js which feels instant, because of the cache
how can i implement this? and why the Solid-start's cache function does not have a tag or date. it would make everything just easier
2 Replies
Maybe this is helpfull:
https://neon.com/guides/caching-with-materialized-views
Neon
Caching Layer in Postgres - Neon Guides
A step-by-step guide describing how to use materialized views for caching in Postgres
Solid-start does not have a real cache layer. The query function is just intended to de-duplicate parallel requests of the same data.
The issue is that server-side caching highly depends on the deployment platform.
High level example:
Caching on dedicated server or VPS vs serverless platforms.
And there’s also client-side caching. You can set caching headers to the responses here’s an example;
https://docs.solidjs.com/solid-start/advanced/return-responses#examples
but then there’s no way to invalidate the cache.
Returning responses - SolidStart Docs
Documentation for SolidJS, the signals-powered UI framework