dist/lib/methodCache.js
function call(method, key) {
    if (!exports.results.has(method))
        create(method); // create as needed
    const methodCache = exports.results.get(method);
    let callResults;
    if (methodCache.has(key)) {
        log_1.logger.debug(`[${method}] Calling (cached): ${key}`);
        // return from cache if key has been used on method before
        callResults = methodCache.get(key);
    }
    else {
        // call and cache for next time, returning results
        log_1.logger.debug(`[${method}] Calling (caching): ${key}`);
        callResults = exports.instance.call(method, key).result;
        methodCache.set(key, callResults);
    }
    return Promise.resolve(callResults);
}
function call(method, key) {
    if (!exports.results.has(method))
        create(method); // create as needed
    const methodCache = exports.results.get(method);
    let callResults;
    if (methodCache.has(key)) {
        log_1.logger.debug(`[${method}] Calling (cached): ${key}`);
        // return from cache if key has been used on method before
        callResults = methodCache.get(key);
    }
    else {
        // call and cache for next time, returning results
        log_1.logger.debug(`[${method}] Calling (caching): ${key}`);
        callResults = exports.instance.call(method, key).result;
        methodCache.set(key, callResults);
    }
    return Promise.resolve(callResults);
}
function call ( method , key ) { if ( ! exports . results . has ( method ) ) create ( method ) ; // create as needed const methodCache = exports . results . get ( method ) ; let callResults ; if ( methodCache . has ( key ) ) { log_1 . logger . debug ( ` ${ method } ${ key } ` ) ; // return from cache if key has been used on method before callResults = methodCache . get ( key ) ; } else { // call and cache for next time, returning results log_1 . logger . debug ( ` ${ method } ${ key } ` ) ; callResults = exports . instance . call ( method , key ) . result ; methodCache . set ( key , callResults ) ; } return Promise . resolve ( callResults ) ; }
Get results of a prior method call or call and cache.
@param method Method name, to call on instance in use
@param key Key to pass to method call and save results against
Get results of a prior method call or call and cache .