I am in the middle of switching from ReactNative
to NextJS
, and I like the fetch
caching but Iam trying to figure out if NextJS
does any "garbage collection" for invalidatedTags or does it just leave them on disk?
If it just leave them sitting there, can anyone recommend a method to delete invalidated
objects?
Next.js does not automatically perform "garbage collection" for invalidated cache tags. Once a tag is invalidated, the cache remains until it is overwritten or manually cleared. To remove invalidated cache entries, you can periodically clear the cache using revalidatePath
or similar methods, or implement a custom cache management strategy to delete stale objects.