NextJS Cache Invalidation Runbook¶
Overview¶
This runbook provides step-by-step instructions for invalidating NextJS cache in the GO application when content changes in DPL-CMS are not reflecting on the frontend.
When to Use This Runbook¶
- Content changes in DPL-CMS are not appearing on the GO frontend
- Specific pages or content sections appear stale
Prerequisites¶
- Access to the GO site's cache invalidation endpoint
- Knowledge of the specific content that needs cache invalidation
- Cache invalidation secret for the environment
Step-by-Step Procedure¶
Step 1: Identify Cache Tags¶
- Make a request to the DPL-CMS
/graphql
endpoint for the content you want to invalidate. - Check the response headers for
x-dpl-graphql-cache-tags
- Look for cache tags that start with
node:[id]
where[id]
is the content identifier
When you want to get the cache tags you can find a query by either looking through the dpl-go repository for queries or construct one by using the graphql explorer tool in dpl-cms. Here is a query that probably will not change in the future:
Example Response Header:
Step 2: Invalidate Cache¶
- Construct the cache invalidation URL:
- Make a POST request to the GO site's cache invalidation endpoint
Example for TÄrnby Library:
curl -X POST "https://go.taarnbybib.dk/cache/revalidate?secret=JYTgIdNLkl3RBip7zJAW3K1qqiAb7fWmp2M5NgoMrowPq2u3iFhZi5t9i2Y53j32askdnasdj/w17chieeYvw==&tags=node:597"
Step 3: Verify Success¶
- Check the response status code
- A
200
status code indicates successful cache invalidation - Verify the content change is now visible on the frontend