Losing my ISR cache data every time I do a deploy

Hey folks,
I have a relatively large ISR site (50lakhs+++ pages). ISR works well, but I’m losing my cache every time I do a deploy, which is less than ideal. I want these pages primed as we’re optimizing for SEO, and I don’t know if an invalidation is needed to refresh the pages content. The Vercel docs states that ISR cache is automatically put in durable storage but every time I deploy, I lose the cache data and it needs to be warmed again.
What am I missing?

thanks

Hi @akash-electron, welcome to the Vercel Community!

Can you share the ISR strategy you are using: time based revalidation or on-demand invalidation?

For more help, please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

export async function generateStaticParams() {

// Generate only TOP priority pages at build time

// Rest will be generated on-demand with ISR

try {

const staticParams: any\[\] = \[\];



const googlePageResponse = await getGooglePageSlugsWithLimit(10000, 1);

const V4SlugPage = await getV4PageSlugsWithLimit(10000, 1);



googlePageResponse?.data?.forEach((item) => {

staticParams.push({

        slugs: \[item.placeNameSlug, item.slug\],

      });

    });

V4SlugPage?.data.forEach((item) => {

staticParams.push({

        slugs: \[item.parentSlug, item.placeNameSlug, item.slug\],

      });

    });



console.log(`Pre-generating ${staticParams.length} priority pages`);

return staticParams;

  } catch (error) {

console.error("Error generating static params:", error);

return \[\];

  }

}



// ISR Configuration - Generate on-demand with caching

export const revalidate = 86400; // Cache for 24 hours

export const dynamicParams = true; // Enable on-demand generation

i am doing ISR and on-demand generation
@anshumanb

1 Like

will you explain me what am i doing wrong in this ?? or what i need to do extra..

@anshumanb

Hi @akash-electron, I’ll try to make a reproducible example out of this. I’ll keep you posted here.

Hi @akash-electron, I think your code is fine, not sure about your full use case. But, yes, ISR cache is unique for each deployment to give accurate invalidations and support rollback.

I think you can architect your dynamic pages better by a mix of revalidate time and server side cache primitives Getting Started: Caching and Revalidating | Next.js for faster loads.

Let me know if you further want to discuss this or have questions.