MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / get

Method get

src/lib/apiCache.ts:37–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 constructor(private ttl: number) {}
36
37 get(): T | null {
38 if (!this.entry) return null;
39 if (Date.now() - this.entry.fetchedAt > this.ttl) {
40 this.entry = null;
41 return null;
42 }
43 return this.entry.data;
44 }
45
46 set(data: T): void {
47 this.entry = { data, fetchedAt: Date.now() };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected