MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / get

Method get

source code/utils/git/gitFilesystem.ts:465–487  ·  view source on GitHub ↗

* Get a cached value by key. On first call for a key, computes and caches it. * Subsequent calls return the cached value until a watched file changes, * which marks the entry dirty. The next get() re-computes from disk. * * Race condition handling: dirty is cleared BEFORE the async compu

(key: string, compute: () => Promise<T>)

Source from the content-addressed store, hash-verified

463 * get() will re-read again rather than serving a stale value.
464 */
465 async get<T>(key: string, compute: () => Promise<T>): Promise<T> {
466 await this.ensureStarted()
467 const existing = this.cache.get(key)
468 if (existing && !existing.dirty) {
469 return existing.value as T
470 }
471 // Clear dirty before compute — if the file changes again during the
472 // async read, invalidate() will re-set dirty and we'll re-read on
473 // the next get() call.
474 if (existing) {
475 existing.dirty = false
476 }
477 const value = await compute()
478 // Only update the cached value if no new invalidation arrived during compute
479 const entry = this.cache.get(key)
480 if (entry && !entry.dirty) {
481 entry.value = value
482 }
483 if (!entry) {
484 this.cache.set(key, { value, dirty: false, compute })
485 }
486 return value
487 }
488
489 /** Reset all state. Stops file watchers. For testing only. */
490 reset(): void {

Callers 15

normalizePatternsToPathFunction · 0.45
getPatternsByRootFunction · 0.45
matchingRuleForInputFunction · 0.45
toCompactBlockFunction · 0.45
convertRulesToUpdatesFunction · 0.45
ingestMethod · 0.45
downloadAndVerifyBinaryFunction · 0.45
getProcessIdForAgentFunction · 0.45
getCurrentAgentInfoFunction · 0.45

Calls 2

ensureStartedMethod · 0.95
setMethod · 0.80

Tested by

no test coverage detected