Reports whether the cache is bound to this Worker.
The Worker environment.
true when the binding is present.
Lists the keys under a prefix.
The Worker environment.
The key prefix to match.
The matched key names.
Returns a cached value, computing and caching it on a miss.
The read-through pattern most callers actually want — one call instead of a get, a branch, and a set.
The cached or freshly computed value.
Drops a cached value.
Deleting a key that was never written is not an error.
The Worker environment.
The cache key.
Writes a value.
The Worker environment.
The cache key.
The value to store.
Optionalttl: number
Lifetime in seconds. Falls back to the configured default; Cloudflare enforces a minimum of 60.
Cache capability, backed by Workers KV.
Values are stored as JSON and expire on the TTL the configuration layer settled on, unless a call names its own.
Remarks
A cache is optional infrastructure: when the namespace is not bound, reads miss and writes are dropped rather than raising. That keeps a Worker deployed without KV working — slower, not broken.
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0