The runtime handle the cache is resolved from.
Reports whether the capability is actually usable on this runtime.
The runtime handle.
true when calls will reach a real backing resource.
A capability backed by an optional resource answers false when that
resource was never provisioned. Implementations must document what each
method does in that state — degrade or throw — and must not vary it, since
a caller choosing between two implementations is relying on the answer
meaning the same thing in both.
Lists the keys under a prefix.
The runtime handle.
The key prefix to match.
The matched key names.
Returns a cached value, computing and caching it on a miss.
The cached or freshly computed value.
Drops a cached value. Removing a key that was never written is not an error.
The runtime handle.
The cache key.
Writes a value.
The runtime handle.
The cache key.
The value to store.
Optionalttl: number
Lifetime in seconds. Falls back to the configured default.
A key-value cache holding JSON-serialisable values under a lifetime.
Remarks
A cache is optional infrastructure by definition: an implementation whose Capability.isAvailable is
falsemust read as a miss and drop writes rather than throwing, so a deployment without one runs slower instead of failing. That is a requirement on every implementation, not an accident of one of them — a caller that branched on it would defeat the point.Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0