( db: Database, canonicalPath: string, )
| 57 | // Look up a canonical path. Returns undefined on a miss, a positive |
| 58 | // inode hit, or a negative (known-absent) hit. Bumps LRU recency. |
| 59 | export function lookupResolveCache( |
| 60 | db: Database, |
| 61 | canonicalPath: string, |
| 62 | ): ResolveCacheHit | undefined { |
| 63 | const cache = cacheFor(db); |
| 64 | const value = cache.get(canonicalPath); |
| 65 | if (value === undefined) { |
| 66 | return undefined; |
| 67 | } |
| 68 | // Move to most-recent position for LRU eviction. |
| 69 | cache.delete(canonicalPath); |
| 70 | cache.set(canonicalPath, value); |
| 71 | return value === NEGATIVE ? { kind: "negative" } : { kind: "inode", inode: value }; |
| 72 | } |
| 73 | |
| 74 | // Cache a resolution. `inode === null` records a negative entry. No-op |
| 75 | // while a transaction is active so the cache never reflects |
no test coverage detected