11 Replies
There is an experimental caching feature within the SDK client itself, an example of which you can find in the first code block here: https://xata.io/docs/concepts/how-it-works#edge-caching-and-edge-functions-private-beta
This works at the client level, each client instantiation having its own cache. It is a simple approach, in anticipation of our new Edge Caching layer that provides a global edge cache (first item in our roadmap here: https://xata.io/roadmap). The new Edge caching should available for early access in the coming weeks so watch this space!
How Xata works
Xata paves the way for scalability, efficient data operations, and accelerated app development
this helps greatly, I'm seeing multiple requests to the DB, especially for stale data, and I'll like to limit that
It works! Not so experimental after all.
Thanks for giving it a try and glad to read it helps! There might just be some rough edges (like this example here https://github.com/xataio/client-ts/issues/907) but the upcoming edge cache will polish those.
okay, i made a mistake
i think the cache miss I'm getting now is from nextjs, how can I definitely confirm that it's cached?
never mind, it working fine 😅
Apologies for the confusion
Ah ok great. I don't think there is a way to inspect the experimental cache at this point. The only way I can think of to check if a result is served from the cache or not is to update its value (from the UI) and see what you get back after the update.
the rough check i am using is simply commenting and uncommenting the cache option
that definitely works as well 🙂
Okay, the cache definitely works, regardless of what Nextjs is reporting. It looks it doesn't live very long in the dev server. Ill try in the prod and get back to you
Sounds good, it should help trim down some response times 🙂
I am happy to report that it works as expected in prod after 10 mins TTL
Really happy to read this. There will be major improvements on this front soon, but it is great that the local cache is helpful until then.