Skip to main content

Quickstart

Here is a practical example of caching a HTML page on the edge, but updating the content based on a query parameter.

Updating a cache in middleware

Here is an example of updating a cache in middleware

Refresh and purge a cached value on demand

Expose a single URL that serves a cached JSON payload on GET, regenerates it on POST, and clears it on DELETE. Useful for cache-warming endpoints, manual invalidation hooks, or scheduled refreshes from an upstream job.
The POST handler awaits cache.put() so the acknowledgement reflects that the value actually landed. For fire-and-forget refreshes, wrap it with Bunny.v1.waitUntil(cache.put(cacheKey, fresh.clone())) and return the ack immediately.

References

Last modified on July 1, 2026