Cache Management & Cloudflare Targeted Purge
Deliver lightning-fast cached Markdown payloads using WordPress transient storage, granular TTL profiles, automated Cloudflare edge purge, and scheduled background warmup.
1. Markdown Cache Architecture
Parsing HTML into clean Markdown requires DOM extraction and CSS selector filtering. To eliminate repetitive CPU overhead on high-traffic sites, AI Markdown Generator includes a multi-tier caching system:
- Local Cache Store: Pre-rendered Markdown payloads are cached in WordPress transients or disk storage.
- Automatic Cache Invalidation: Whenever a post, page, or taxonomy term is edited or published, its Markdown cache key is instantly invalidated.
- Cache Response Headers: All responses include the
X-AI-Markdown-Cache: HITorMISSheader for transparent monitoring.
2. Cloudflare Targeted Edge Purge (Pro)
If your website uses Cloudflare CDN, edge servers might continue serving cached Markdown representations even after WordPress content changes. The Pro add-on connects directly to the Cloudflare API v4 to issue targeted cache purges:
files API payload. It never triggers a site-wide purge_everything, protecting your overall edge cache hit ratio.
Obtain Cloudflare API Token
In your Cloudflare Dashboard, go to My Profile → API Tokens → Create Token. Use the "Cache Purge" template with Zone.Cache Purge permissions for your domain zone.
Configure in WP-Admin
Navigate to Settings → AI Markdown → Cloudflare CDN. Enter your Zone ID and API Token, then click Test Connection to verify API communication.
3. Scheduled Cache Warmup (WP-Cron)
To ensure AI scrapers always receive instant cache hits, the Pro add-on includes an automated background warmup engine powered by WP-Cron:
- Configurable Scope: Pre-warm home manifest files (
/llms.txt), recent posts, and key pages. - Concurrency Locking: Built-in stampede protection (
ai_pro_warmup_running) prevents multiple cron workers from overlapping. - Audit Logging: All warmup runs are logged in the zero-PII Audit Log table with HTTP status codes and cache outcomes.
4. Verifying Cache Status
Inspect the response headers from your terminal to verify cache performance:
# First request (triggers cache generation)
curl -i -H "Accept: text/markdown" https://your-site.com/seo-post/
# Look for: X-AI-Markdown-Cache: MISS
# Second request (served instantly from cache)
curl -i -H "Accept: text/markdown" https://your-site.com/seo-post/
# Look for: X-AI-Markdown-Cache: HIT - First request returns
X-AI-Markdown-Cache: MISS. - Subsequent requests return
X-AI-Markdown-Cache: HIT. - Post updates trigger automatic targeted cache purge.
- Granting Global API Key instead of a scoped API Token with Cache Purge permissions.
- Disabling WP-Cron without configuring a system cron job for background warmup.