MCPcopy
hub / github.com/prisma/prisma / getOrCreate

Method getOrCreate

packages/client-common/src/Cache.ts:15–23  ·  view source on GitHub ↗
(key: K, create: () => V)

Source from the content-addressed store, hash-verified

13 }
14
15 getOrCreate(key: K, create: () => V): V {
16 const cached = this._map.get(key)
17 if (cached) {
18 return cached.value
19 }
20 const value = create()
21 this.set(key, value)
22 return value
23 }
24}

Callers 8

resolveNeedsFunction · 0.80
getAllComputedFieldsMethod · 0.80
getAllModelExtensionsMethod · 0.80
getAllQueryCallbacksMethod · 0.80
getPropertyValueFunction · 0.80
Cache.test.tsFile · 0.80

Calls 3

setMethod · 0.95
createFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected