MCPcopy Create free account
hub / github.com/cloudflare/computer / cacheFor

Function cacheFor

packages/dofs/src/fs/writeBuffer.ts:54–61  ·  view source on GitHub ↗
(db: Database)

Source from the content-addressed store, hash-verified

52const caches = new WeakMap<Database, DatabaseCache>();
53
54function cacheFor(db: Database): DatabaseCache {
55 let cache = caches.get(db);
56 if (cache === undefined) {
57 cache = { byInode: new Map(), byPendingPath: new Map(), nextPendingInode: -1 };
58 caches.set(db, cache);
59 }
60 return cache;
61}
62
63export function getWriteBuffer(db: Database, inode: number): WriteBufferEntry | undefined {
64 return caches.get(db)?.byInode.get(inode);

Callers 2

setWriteBufferFunction · 0.70
allocatePendingInodeFunction · 0.70

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected