Back to docs
Recipes

Cache invalidation

Purge stale data without tearing down your entire cache. Meridian gives you surgical control over what gets evicted and when.

Tag-based invalidation

Every cached entry carries one or more tags. Call the invalidate endpoint with a tag and Meridian purges every entry that matches.

POST /api/cache/invalidate
Content-Type: application/json

{ "tags": ["user:42", "dashboard"] }

Prefix sweeps

When you need broader eviction, prefix matching clears every key starting with a given string — ideal for tenant-wide or environment-wide flushes.

POST /api/cache/invalidate
Content-Type: application/json

{ "prefix": "tenant:acme:" }

Time-to-live overrides

Shorten the TTL on existing entries without purging them. The next read will refresh from origin if the new deadline has passed.

POST /api/cache/invalidate
Content-Type: application/json

{ "tags": ["products"], "ttl": 60 }

Atomic swap

Replace a cached value in a single atomic operation. No read-then-write gap, no stale window.

POST /api/cache/swap
Content-Type: application/json

{
  "key": "config:v2",
  "value": { "theme": "violet" },
  "tags": ["config"]
}

Need real-time invalidation across regions? Edge replication →