MCPcopy
hub / github.com/webpack/webpack / getFromUnorderedCache

Method getFromUnorderedCache

lib/util/SortableSet.js:136–149  ·  view source on GitHub ↗

* Get data from cache (ignoring sorting) * @template R * @param {(set: SortableSet<T>) => R} fn function to calculate value * @returns {R} returns result of fn(this), cached until set changes

(fn)

Source from the content-addressed store, hash-verified

134 * @returns {R} returns result of fn(this), cached until set changes
135 */
136 getFromUnorderedCache(fn) {
137 if (this._cacheOrderIndependent === undefined) {
138 this._cacheOrderIndependent = new Map();
139 } else {
140 const result = this._cacheOrderIndependent.get(fn);
141 const data = /** @type {R} */ (result);
142 if (data !== undefined) {
143 return data;
144 }
145 }
146 const newData = fn(this);
147 this._cacheOrderIndependent.set(fn, newData);
148 return newData;
149 }
150
151 /**
152 * Invalidates the cached state associated with this value.

Calls 3

fnFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected