UNCACHEABLEconstno test imports itconst UNCACHEABLE: readonly ["batch", "rename", "append", "rangeRead", "search", "merge"]The capabilities a cache cannot keep in step.
The cached layer: a read goes through a cache that is itself a store. A read asks the origin for the revision of the path, which is cheap, and gives the cached bytes where the revision is the one cached; it fetches and keeps the bytes otherwise. A write or a delete goes to the origin and drops the cached copy, whatever it ends with, because a failed write leaves the object in an unknown state. The cache is never trusted over the origin: the revision the origin gives decides.
The cache keeps two objects for each path, the bytes under d/<path> and the revision they were read at under r/<path>. A batch, a rename, an append, a ranged read and a search are not carried: the cache could not keep them in step.
import { cached } from "./cached.ts";
// const store = cached(origin, memoryStore)UNCACHEABLEconstno test imports itconst UNCACHEABLE: readonly ["batch", "rename", "append", "rangeRead", "search", "merge"]The capabilities a cache cannot keep in step.
cachedfunctionfunction cached<C extends Capability>(origin: StoreBase & UnionToIntersection<{ [K in C]: Group<K, C>; }[C]> & { readonly "@anyfs/capabilities"?: ((capability: C) => void) | undefined; } & NoInfer<Store<"read" | "stat">>, cache: Store<"delete" | "read" | "write">): Store<Exclude<C, "append" | "batch" | "lock" | "merge" | "rangeRead" | "rename" | "search" | "watch">>A store that reads through a cache and keeps the capabilities of its origin but those a cache cannot keep.