Cache Invalidation (Domain Mapping)
Introduction
NextJS relies on content and menu items served by Drupal. A data synchronization strategy is implemented to ensure that data updates on Drupal side propagate to NextJS through a seamless cache invalidation strategy. This is a summary of how such transactions are mapped between Drupal and Vercel (NextJS hosting).
Environment Mapping
Cache Invalidation Strategy
Content Updates
When content is saved in Drupal CMS:
- Drupal triggers a revalidation request to the appropriate Vercel environment
- The request includes specific tags (e.g.,
story_published_en,node:1234) - Next.js invalidates cached pages that match these tags
- Fresh content is fetched on the next request
Menu Updates
When menu items are updated:
- Drupal sends invalidation request to the meganav micro-frontend
- Both the main site and navigation components are updated
- Changes propagate across all affected pages
Redirect Updates
When redirects are modified:
- Drupal triggers revalidation of the redirect configuration
- Next.js updates its internal redirect mapping
- New redirect rules take effect immediately
Key Benefits
- Real-time Updates: Content changes in Drupal appear on the live site without manual intervention
- Performance: Only affected pages are invalidated, maintaining cache performance for unaffected content
- Reliability: Automated process reduces risk of content inconsistencies
- Environment Parity: Same invalidation strategy works across all environments
Monitoring & Troubleshooting
- Monitor invalidation requests in Vercel deployment logs
- Check Drupal logs for failed webhook calls
- Verify cache tags are properly set on Next.js pages
- Test invalidation manually using the revalidate API endpoints