MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / readCached

Method readCached

packager/src/node-haste/Module.js:342–351  ·  view source on GitHub ↗

* Same as `readFresh`, but reads from the cache instead of transforming * the file from source. This has the benefit of being synchronous. As a * result it is possible to read many cached Module in a row, synchronously.

(transformOptions: TransformOptions)

Source from the content-addressed store, hash-verified

340 * result it is possible to read many cached Module in a row, synchronously.
341 */
342 readCached(transformOptions: TransformOptions): CachedReadResult {
343 const key = stableObjectHash(transformOptions || {});
344 let result = this._readResultsByOptionsKey.get(key);
345 if (result != null) {
346 return result;
347 }
348 result = this._readFromTransformCache(transformOptions, key);
349 this._readResultsByOptionsKey.set(key, result);
350 return result;
351 }
352
353 /**
354 * Read again from the TransformCache, on disk. `readCached` should be favored

Callers 3

readMethod · 0.95
resolveDependenciesMethod · 0.45
preprocessModuleMethod · 0.45

Calls 4

stableObjectHashFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected