describe('#__del', () => { it('should be the same as new NodeCache().del', () => { filesystem(); const cache = new Cache(); const nCache = new NodeCache(); cache.__set('yyz', 'amazing'); const returnone = cache.__del('yyz'); nCache.set('yyz', 'amazing'); const returntwo = nCache.del('yyz'); returnone.should.eql(returntwo); filesystem.restore(); }); });
cache.should.be.instanceof(Cache); cache.should.be.an('object').with.property('options'); cache.options.should.have.property('stdTTL', 0); cache.options.should.have.property('checkperiod', 600); cache.options.should.have.property('errorOnMissing', false); cache.options.should.have.property('useClones', true); cache.options.should.have.property('deleteOnExpire', true); });
imdb(url,function(err,things) { if (err) { var query = (context.req.query.q) ? context.req.query.q : ""; _logger.debug("Query : " + query); _logger.debug(context.req.query); research( baseUrl + "/torrents/search/"+query ,reponseSearch.bind( {context:context} ),context.req.query); } else { MovieCache.set(context.req.query.imdbid,things); researchMovie(things,context); } });
let getSummaryFromCache = (key) => { return new Promise(((resolve, reject) => { console.log('*** loading summary from cache ***'); let dataModels = covidCache.get(key); if(!modelConverter.isEmptyObject(dataModels)){ apiResponse.SUCCESS.data = dataModels; resolve(apiResponse.SUCCESS); }else{ reject(apiResponse.RECORD_NOT_FOUND); } })); }
// Check function _checkAgainstCache(events) { if (!events) { return events; } if (!Array.isArray(events)) { return events; } return events.filter(currentEvent => { const cachedEvent = eventCache.get(currentEvent.id); return cachedEvent ? _handleExistingEvent(currentEvent, cachedEvent) : _handleNewEvent(currentEvent); }); }