interface ICacheApi
Since 0.2.0

The subset of the platform's Cache this package calls.

A real caches.default satisfies it structurally.

Scope is per-datacenter. caches.default is the colo's own cache: a hit rate measured in one location says nothing about another, and a delete does not evict globally. It is an edge-latency optimisation, not a shared store — for that, use CAPABILITIES.CACHE over KV.

Methods

match(request: Request | string): Promise<Response | undefined>

Looks up a cached response.

put(
request: Request | string,
response: Response
): Promise<void>

Stores a response.

Throws on the platform's own refusals — a non-GET request, status 206, Vary: *, or an uncleared Set-Cookie — which is why assessCacheability checks first rather than letting this reject.

delete(request: Request | string): Promise<boolean>

Removes a cached response.

Usage

import { type ICacheApi } from "cloudflare-plugin/src/index.ts";