Quickstart
This example caches an HTML page at the edge, then rewrites part of it per request from a query parameter.Updating a cache in middleware
This example writes to the cache from middleware when the incoming request is a POST, and reads the entry back from a standalone script.Refresh and purge a cached value on demand
Expose a single URL that serves a cached JSON payload onGET, 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
- Cache API overview: regional behavior, limitations, and API surface.
- Managing caches: the global
cachesobject and named cache instances. - Reading & writing: the
match,put, anddeletemethod reference. - Runtime: waitUntil: extend the isolate lifetime for background cache writes.