MCPcopy
hub / github.com/nodejs/undici / constructor

Method constructor

lib/core/connect.js:16–29  ·  view source on GitHub ↗
(maxCachedSessions)

Source from the content-addressed store, hash-verified

14
15const SessionCache = class WeakSessionCache {
16 constructor (maxCachedSessions) {
17 this._maxCachedSessions = maxCachedSessions
18 this._sessionCache = new Map()
19 this._sessionRegistry = new FinalizationRegistry((key) => {
20 if (this._sessionCache.size < this._maxCachedSessions) {
21 return
22 }
23
24 const ref = this._sessionCache.get(key)
25 if (ref !== undefined && ref.deref() === undefined) {
26 this._sessionCache.delete(key)
27 }
28 })
29 }
30
31 get (sessionKey) {
32 const ref = this._sessionCache.get(sessionKey)

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected