3 ms·
Funny, I actually tried finding tricks exploiting the cache from Vercel, but it didn't work. Initially I thought I could find a way to use it to share data acro
by Elzear 3y ago
Funny, I actually tried finding tricks exploiting the cache from Vercel, but it didn't work. Initially I thought I could find a way to use it to share data across users, but nothing worked. Do you have any links to resources that could help getting a datastore from the Vercel cache?
I will try adding things you mentioned, and I'd love to find way to also have stupidly complex/convoluted storage systems, inspired by tom7's harder drives: https://www.youtube.com/watch?v=JcJSW7Rprio https://www.youtube.com/watch?v=JcJSW7Rprio
- quickthrower2 3y agoMy example is very simple. I am pretty much using it as a cache I guess. Firstly there is an external product feed API that returns JSON. In a single file I have an async function fetch from it and do some transformations. In various pages (and I am using the new App Router so this might be different) I just call the function from an async React component and then use that data to do server-side generation. The catch is that it is limited to 2Mb calls for caching. Otherwise the fetch works but they don't cache it. I am going to experiment to see if I can just store the data in memory globally. This may not be a great approach for data provided by users. And it is a cache, so the data can be lost of course. Since in my case I can go back to the API it is of no concern.