Now that Nextjs 16 CacheTags is live (Are 128 cache tags enough for DatoCMS?) [Edited title]

Yes, that would be great :frowning: Next.js/Vercel is unfortunately one of the frameworks that has this issue, and it’s not something we are able to change on our end (it’s up to Vercel and their CDNs).

In our Next starter kit, we have an example of how to map Dato cache tags to specific Next queries and then store that in an external KV (in this case, Turso): https://github.com/datocms/nextjs-with-cache-tags-starter/blob/main/lib/database.ts

This other discussion also has an example of how to modify that implementation to work with a redis-compatible store: NextJS + Vercel + Dato Cache Tags not always working - #5 by roger. At the time, that example targeted Vercel KV, a now-defunct, whitelabeled version of Upstash. Vercel deprecated that and now just links to third-party redis implementations, but the basic logic should still be the same and it shouldn’t be too hard to modify it e.g. for Valkey or similar.

This sort of mapping is not ideal, but is necessary as long as Next/Vercel has these small cache tag limits :frowning:

I know this is frustrating, but as far as we can tell, our hands are kind of tied here due to Next’s limits. This is something we’ve given a significant amount of thought and experimentation to in the past, and could not find a good solution to, hence our workarounds and all the mapping needed. If anyone has a better idea about how we could or should do this (like @martin.palma ā€œcompressed bucketsā€ idea…? which I still don’t quite understand, sorry)… please let us know and we can definitely investigate!