generated from trieb-work/public-typescript-npm-package-starter
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hi,
We’re running in a multi-stage environment (dev/test/prod), all using the same Docker image.
With @neshca/cache-handler, we previously handled cache prepopulation by having generateStaticParams return an empty array during build, and then using the instrumentation.ts file to prepopulate the Redis cache at startup.
This is how our generateStaticParams looked like previously:
export async function generateStaticParams() {
if (isDuringProductionBuild()) return []
return SUPPORTED_LANGUAGES.map(lang => ({ lang }))
}
And our instrumentation.ts
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
const { registerInitialCache } = await import('@neshca/cache-handler/instrumentation')
const CacheHandler = (await import('./cache-handler.mjs')).default
console.info('Loading the initial cache')
await registerInitialCache(CacheHandler, { fetch: true, pages: true, routes: true })
console.info('Loaded the initial cache')
}
}
Is it possible to achieve something similar with nextjs-turbo-redis-cache?
If so, could you provide some guidance or an example of how to set that up?
Thanks!
martis900
Metadata
Metadata
Assignees
Labels
No labels