MCPcopy Index your code
hub / github.com/nodejs/node / set

Method set

deps/undici/undici.js:3161–3181  ·  view source on GitHub ↗
(sessionKey, session)

Source from the content-addressed store, hash-verified

3159 return ref ? ref.deref() : null;
3160 }
3161 set(sessionKey, session) {
3162 if (this._maxCachedSessions === 0) {
3163 return;
3164 }
3165 if (this._sessionCache.has(sessionKey)) {
3166 this._sessionCache.delete(sessionKey);
3167 } else if (this._sessionCache.size >= this._maxCachedSessions) {
3168 for (const [key, ref] of this._sessionCache) {
3169 if (ref.deref() === void 0) {
3170 this._sessionCache.delete(key);
3171 return;
3172 }
3173 }
3174 const oldest = this._sessionCache.keys().next();
3175 if (!oldest.done) {
3176 this._sessionCache.delete(oldest.value);
3177 }
3178 }
3179 this._sessionCache.set(sessionKey, new WeakRef(session));
3180 this._sessionRegistry.register(session, sessionKey);
3181 }
3182 };
3183 function buildConnector({ allowH2, preferH2, useH2c, maxCachedSessions, socketPath, timeout, session: customSession, ...opts }) {
3184 if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {

Callers

nothing calls this directly

Calls 6

hasMethod · 0.65
deleteMethod · 0.65
nextMethod · 0.65
keysMethod · 0.65
setMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected