Caching on server
Answered
African Slender-snouted Crocodil… posted this in #help-forum
African Slender-snouted CrocodileOP
How can I cache data in a server component? I fetch data from meilisearch so im not calling any fetch function to use revalidate im simply calling a function from meilisearch built-in library
Answered by Roseate Spoonbill
1. With
2. with
3. Sometimes sdk libraries allow you to inject some things to fetch options before request starts (usually this is called
use cache if you are fine with using canary build: https://nextjs.org/docs/app/api-reference/directives/use-cache2. with
unstable_cache which is previous proposition for cache api: https://nextjs.org/docs/app/api-reference/functions/unstable_cache3. Sometimes sdk libraries allow you to inject some things to fetch options before request starts (usually this is called
hooks, middleware (not to confuse it with Next middlewares!) or events. Highly depends on SDK, but if possible, I'd look into something like this.2 Replies
Roseate Spoonbill
1. With
2. with
3. Sometimes sdk libraries allow you to inject some things to fetch options before request starts (usually this is called
use cache if you are fine with using canary build: https://nextjs.org/docs/app/api-reference/directives/use-cache2. with
unstable_cache which is previous proposition for cache api: https://nextjs.org/docs/app/api-reference/functions/unstable_cache3. Sometimes sdk libraries allow you to inject some things to fetch options before request starts (usually this is called
hooks, middleware (not to confuse it with Next middlewares!) or events. Highly depends on SDK, but if possible, I'd look into something like this.Answer
African Slender-snouted CrocodileOP
Ty ty sir