Skip to content

Manage cache TTLs and purge stale AI outputs instantly

Set smart time-to-live schedules and invalidate tagged cache entries via webhook the second underlying product docs or pricing change.

Copy the prompt and paste it into the AI assistant you already use.

Checklist for accurate AI cache freshness

  1. 01

    Match TTL to source volatility

    Assign long TTLs to static copy tasks and short minute-scale TTLs to live state summaries.

  2. 02

    Tag caches by source entity ID

    Attach surrogate keys like doc:123 so CMS update webhooks purge exact records surgically.

  3. 03

    Enable stale-while-revalidate

    Keep user latency low by serving slightly stale cache briefly while background refresh completes.

  4. 04

    Avoid blind global cache clears

    Target purges by endpoint or surrogate tag so upstream providers are not slammed simultaneously.

Common questions

What is stale-while-revalidate for AI endpoints?

Users receive the cached response in milliseconds once TTL expires while APIkit refreshes the entry once in the background.

How do CMS updates purge stale cached answers?

Trigger a lightweight purge API call with the updated document tag from your CMS webhook to expire affected keys instantly.

Are cached responses automatically cleared on prompt edits?

Yes. Deploying a new prompt revision shifts the cache namespace automatically so old outputs never linger.