StaticcleanupStaticclearDelete cached entries.
Like clearByClassName, this is a re-fetch and steps over
persistent operational state (see cacheKeys.ts). The broad gesture is the
one an operator reaches for when a symptom spans several destinations,
which is exactly when quietly discarding what we have observed does the
most damage. Pass includePersistent for a genuine full wipe.
StaticclearDelete cached entries across every destination. Returns number deleted.
Steps over persistent operational state for the same reason
clearByClassName does; pass includePersistent for a full wipe.
StaticclearDelete all cache entries whose key contains the given class name.
Matches both plain keys (ClassName:method:args) and prefixed keys (prefix:ClassName:method:args).
Returns the number of deleted entries.
Keys carrying a PERSISTENT_KEY_FRAGMENTS fragment are stepped
over: this call means "refetch from upstream", not "forget what we have
observed". Pass includePersistent to sweep those too, which is a full
reset of the destination rather than a flush, and is what test setup
wants.
StaticclearTargeted flush: delete one class's live cache rows whose key contains a substring. For operator tooling that needs to drop one stale value, such as a cached upstream version, without refetching everything the class holds.
Differences from clearByClassName, all deliberate:
contains. Matching is literal (_ and % are
not wildcards) and case-sensitive, class name included, where
clearByClassName ignores case. A class is matched the same two ways:
Class:... and prefix:Class:.... The substring is tested against the
class name and arguments, so a short or common one reaches far: pair it
with maxRows.Class:VERB:url:{headers}:body) only the class, the
verb and the URL up to its query string are searchable. Headers, query and
body can carry credentials, and a match count would let a caller recover
one a character at a time. A method argument that is itself a secret is
still searchable in a decorated method's key, so rate-limit untrusted
callers.includePersistent: this is a flush,
never a reset.maxRows makes the call refuse rather than delete a surprising amount:
when more rows match, nothing is deleted and capped is true.The result never contains a raw key (see ClearMatchingResult); a group label is the class plus the identifier-shaped segment after it, which is a method name or HTTP verb for every key the decorators build. Only this process's stored rows are touched. A fetch already in flight when the delete runs can store its result again afterwards, and a value memoised in memory rather than in this cache is not affected.
It only reaches keys that carry the class name. A row stored under a fixed
key (@cache({key: 'someConstant'})) has no class segment, so remove it
with an exact CacheLib.delete.
A large match set is deleted row by row inside the transaction: tens of
thousands of rows stall the event loop for seconds and hold the write lock,
so set maxRows.
StaticdeleteStaticenableEnable temporary mode - use in-memory cache that doesn't persist Must be called before any cache operations
StaticenforceEnforce cache size limit by removing least recently accessed entries. Called periodically from set() rather than on every write.
StaticexpiresWhen the entry under key expires, as a millisecond timestamp.
Null when there is no live entry.
StaticgetStaticgetStatichasStaticisCheck if cache is in temporary mode
StatickeysStaticsetStaticsizeStaticstartStart automatic cleanup of expired entries
StaticstatsGet cache statistics
StaticstopStop automatic cleanup
StaticwrapCache-with-dedup wrapper. Concurrent callers on a cache miss for the same
key share a single execution rather than each running fn independently.
Either a fixed TTL in seconds, or a callback that derives a TTL from the function's result (e.g. for OAuth tokens that expire on a server-supplied schedule).
Optionalcaller: () => Omit<HttpCaller, "retryCount">
Returns who calls, for the method cache observer (see
setMethodCacheObserver). Called only on a hit while an
observer is set.
Remove all expired entries from cache