runCacheDifferentialTck
@rotorsoft/act-root / act-tck/src / runCacheDifferentialTck
Function: runCacheDifferentialTck()
runCacheDifferentialTck(
options):void
Defined in: libs/act-tck/src/cache-differential-tck.ts:176
Cross-implementation differential contract for the Cache port (#1057).
Where runCacheTck pins each method's contract against a single
implementation, this harness drives a family of randomized, seeded
workloads (set / invalidate / clear) against two or more caches
in lockstep and asserts their observable get() snapshot is identical
after every operation. A cache that mishandles overwrite ordering,
leaks an invalidated key, or clears partially diverges from the
reference on the exact operation that broke it โ with the seed in the
describe block for replay.
Streams stay within the cache's capacity, so eviction (an adapter policy, not a contract guarantee) never enters the comparison.
Parametersโ
optionsโ
Returnsโ
void
Exampleโ
import { runCacheDifferentialTck } from "@rotorsoft/act-tck";
import { InMemoryCache } from "@rotorsoft/act";
import { RedisCache } from "../src/index.js";
runCacheDifferentialTck({
name: "InMemory vs Redis",
caches: [
{ name: "InMemoryCache", factory: () => new InMemoryCache({ maxSize: 1000 }) },
{ name: "RedisCache", factory: () => new RedisCache({ url: process.env.REDIS_URL }) },
],
});