Skip to main content

Cache Management

This document explains how to manage the caching system in Infowebplus.

Manual Cache Clearing​

Clear All Cache​

curl -X POST https://your-domain.com/api/cache/clear?all=true \
-H "Authorization: Bearer your-secret-token"

Clear by Pattern​

curl -X POST https://your-domain.com/api/cache/clear?pattern=content:* \
-H "Authorization: Bearer your-secret-token"

Check Cache Status​

curl https://your-domain.com/api/cache/clear

Programmatic Cache Invalidation​

import { deleteCache, deleteCachePattern } from '@/lib/cache'

// Delete specific cache entry
await deleteCache('content:locale:en', 'en')

// Delete all content cache
await deleteCachePattern('content:*')

Sanity Studio Actions​

You can clear cache directly from Sanity Studio:

  1. Open any document in Sanity Studio
  2. Click the three dots menu (⋮)
  3. Select:
    • "Clear Cache" - Clear all cached content
    • "Clear Cache for This Type" - Clear cache for specific content type

See Sanity Cache Actions for details.

Automatic Invalidation​

Cache is automatically invalidated via Sanity webhooks when content is published.

See Sanity Webhooks for setup instructions.

Next Steps​