new Cache(config, optionsopt)
Cache
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | cache key prefix
Properties
|
|||||||||||||
options |
Object |
<optional> |
options passed to memcached |
Example
new Cache('prefix', 'host');
Methods
del(key) → {Promise}
delete an item in the cache
Parameters:
Name | Type | Description |
---|---|---|
key |
string | cache key |
Returns:
- Type
- Promise
get(key) → {Promise}
get a cache item
Parameters:
Name | Type | Description |
---|---|---|
key |
string | cache key |
Returns:
- Type
- Promise
getMulti(keys) → {Promise}
get an object of cache items
Parameters:
Name | Type | Description |
---|---|---|
keys |
array | an array of cache keys |
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 |
Returns:
- Type
- Promise
stats() → {Promise}
gets stats from memcached server
Returns:
- Type
- Promise
utilGet(key) → {Promise}
get a cache item
Parameters:
Name | Type | Description |
---|---|---|
key |
string | full prefixed cache key |
Returns:
- Type
- Promise