MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / get

Method get

backend/api/src/postgres-proxy/utils/cache.util.ts:59–87  ·  view source on GitHub ↗

* Gets a value from cache

(key: string)

Source from the content-addressed store, hash-verified

57 * Gets a value from cache
58 */
59 get(key: string): T | null {
60 const entry = this.cache.get(key);
61
62 if (!entry) {
63 if (this.options.enableStats) {
64 this.stats.misses++;
65 }
66 return null;
67 }
68
69 // Check if expired
70 if (this.isExpired(entry)) {
71 this.cache.delete(key);
72 if (this.options.enableStats) {
73 this.stats.misses++;
74 }
75 return null;
76 }
77
78 // Update access info
79 entry.lastAccessed = Date.now();
80 entry.accessCount++;
81
82 if (this.options.enableStats) {
83 this.stats.hits++;
84 }
85
86 return entry.data;
87 }
88
89 /**
90 * Sets a value in cache

Callers 15

CacheableFunction · 0.95
checkServerFunction · 0.45
auth.spec.tsFile · 0.45
loginMethod · 0.45
refreshAccessTokenMethod · 0.45
verifyAccessTokenMethod · 0.45
auth.module.tsFile · 0.45
generateRefreshTokenMethod · 0.45
validateRefreshTokenMethod · 0.45
loginMethod · 0.45
signupMethod · 0.45

Calls 2

isExpiredMethod · 0.95
deleteMethod · 0.45

Tested by

no test coverage detected