it('Does not interact with a cache when cache is disabled', () => { const promiseX = Promise.resolve('X'); const cacheMap = new Map([ [ 'X', promiseX ] ]); const [ identityLoader ] = idLoader<string>({ cache: false, cacheMap }); identityLoader.prime('A', 'A'); expect(cacheMap.get('A')).toBe(undefined); identityLoader.clear('X'); expect(cacheMap.get('X')).toBe(promiseX); identityLoader.clearAll(); expect(cacheMap.get('X')).toBe(promiseX); });
notifyOnServiceInfo () { setInterval(() => { if (this.widgetsRepo && this.widgetsRepo.has('servicesList')) { // Update on Docker Info this.utilsRepo.get('docker').getInfo((data) => { this.emit('servicesStatus', data) }) } }, 500) }
get hasPending() { /* Although the pending map is bucketed by recordingId, the bucket will always be created with a single item in it so we can assume that if a bucket exists, then it has items in it. */ return this.pending.size > 0; }
/** * Unregister a factory from the container via a key (e.g. `adapter:fetch`) * or Factory class. * * @param {String|Function} keyOrFactory */ unregister(keyOrFactory) { const { _registry: registry } = this; const key = typeof keyOrFactory === 'function' ? keyFor(keyOrFactory) : keyOrFactory; registry.delete(key); }
/** * @public * @memberof Polly */ pause() { this[PAUSED_ADAPTERS] = [...this.adapters.keys()]; this.disconnect(); }
/** * Check a metric by name. * * @param {String} name * @returns {Boolean} * @memberof MetricRegistry */ hasMetric(name) { return this.store.has(name); }
init () { if (!this.widgetsRepo.has('containers')) { return null } const dockerHook = this.widgetsRepo.get('containers') dockerHook.on('containerUtilization', (data) => { return this.update(data) }) }
/** * Get count of all registered nodes */ count() { return this.nodes.size; }
/** * @return {number} */ get size() { return this._map.size; }