|
|
|
|
|
by quickthrower2
1116 days ago
|
|
My 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. |
|