MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / rememberTouch

Function rememberTouch

packages/core/sdk/src/subject-registry.ts:82–91  ·  view source on GitHub ↗
(key: string, at: number)

Source from the content-addressed store, hash-verified

80const touchCacheKey = (tenant: string, externalId: string) => `${tenant}${externalId}`;
81
82const rememberTouch = (key: string, at: number): void => {
83 // Re-insert so the key moves to the end of the Map's insertion order, making
84 // the oldest-touched entry the natural eviction target.
85 lastTouchedAt.delete(key);
86 lastTouchedAt.set(key, at);
87 if (lastTouchedAt.size > MAX_TRACKED_SUBJECTS) {
88 const oldest = lastTouchedAt.keys().next();
89 if (!oldest.done) lastTouchedAt.delete(oldest.value);
90 }
91};
92
93/** Test seam: drop the process-local sighting memory. */
94export const resetSubjectTouchCache = (): void => {

Callers 1

touchSubjectFunction · 0.85

Calls 2

setMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected