Class: Cache

Cache

new Cache(config, optionsopt)

Cache
Parameters:
Name Type Attributes Description
config Object cache key prefix
Properties
Name Type Attributes Description
keyPrefix string <optional>
cache key prefix
cacheHost string <optional>
cache host url
options Object <optional>
options passed to memcached
Source:
Example
new Cache('prefix', 'host');

Methods

del(key) → {Promise}

delete an item in the cache
Parameters:
Name Type Description
key string cache key
Source:
Returns:
Type
Promise

get(key) → {Promise}

get a cache item
Parameters:
Name Type Description
key string cache key
Source:
Returns:
Type
Promise

getMulti(keys) → {Promise}

get an object of cache items
Parameters:
Name Type Description
keys array an array of cache keys
Source:
Returns:
Type
Promise

set(key, data, expiresopt) → {Promise}

set an item in the cache
Parameters:
Name Type Attributes Default Description
key string cache key
data string | number | Object data to set in cache
expires number <optional>
900 expiration of data in seconds
Source:
Returns:
Type
Promise

stats() → {Promise}

gets stats from memcached server
Source:
Returns:
Type
Promise

utilGet(key) → {Promise}

get a cache item
Parameters:
Name Type Description
key string full prefixed cache key
Source:
Returns:
Type
Promise