Class: Cache

Cache

new Cache()

Caching manager for async methods
Source:

Methods

clear(keyopt)

clear cache entries prefix matching given key
Parameters:
Name Type Attributes Description
key String <optional>
Key prefix of cache entry to clear
Source:

get(keyopt) → {CacheEntry}

retrive cache entry, or create if not exists.
Parameters:
Name Type Attributes Description
key String <optional>
Key of cache entry
Source:
Returns:
Type
CacheEntry

(protected) makeCacheable(fn, scopeopt, optionsopt) → {function}

Enable caching for async call fn to lookup the response cache first, then invoke original if no cached value.
Parameters:
Name Type Attributes Description
fn function Function to covert cacheable
scope Object <optional>
Scope of function call
options Object <optional>
Options
Source:
Returns:
- Cached version of function
Type
function

(protected) makeResponseCacheable(fn, scopeopt, optionsopt) → {function}

Enable caching for async call fn to intercept the response and store it to cache. The original async calll fn is always invoked.
Parameters:
Name Type Attributes Description
fn function Function to covert cacheable
scope Object <optional>
Scope of function call
options Object <optional>
Options
Source:
Returns:
- Cached version of function
Type
function