new Redis(url)
Create a promisified wrapper around Redis
Parameters:
Name | Type | Description |
---|---|---|
url |
Where redis is mounted |
Methods
-
deleteKey(key)
-
Promise wrapper for redis.delKey
Parameters:
Name Type Description key
string key to remove from redis -
deleteKey(key)
-
Promise wrapper for redis.delKey
Parameters:
Name Type Description key
string key to remove from redis -
getByKey(key)
-
Get data from redis and parse to JSON
Parameters:
Name Type Description key
data stored by this key -
getByKey(key)
-
Get data from redis and parse to JSON
Parameters:
Name Type Description key
data stored by this key -
getByKeys(keys)
-
Asynchronously get a load of data from redis
Parameters:
Name Type Argument Description keys
<repeatable>
Any number of keys to retrieve -
getByKeys(keys)
-
Asynchronously get a load of data from redis
Parameters:
Name Type Argument Description keys
<repeatable>
Any number of keys to retrieve -
getKeys(key)
-
Promise wrapper to get corresponding keys from Redis
Parameters:
Name Type Description key
string Key prefix for Redis -
getKeys(key)
-
Promise wrapper to get corresponding keys from Redis
Parameters:
Name Type Description key
string Key prefix for Redis -
lazyCache(callback, key)
-
lazy caching Have we found something? great, resolve and then update the cache Not found? get fresh data, and then add it to the cache Promises don't exit upon resolve -- JavaScript only does this when it throws an error, or returns something
Parameters:
Name Type Description callback
function MUST BE A FUNCTION THAT RETURNS A PROMISE. function to get data key
string used to set and retrieve data from redis -
lazyCache(callback, key)
-
lazy caching Have we found something? great, resolve and then update the cache Not found? get fresh data, and then add it to the cache Promises don't exit upon resolve -- JavaScript only does this when it throws an error, or returns something
Parameters:
Name Type Description callback
function MUST BE A FUNCTION THAT RETURNS A PROMISE. function to get data key
string used to set and retrieve data from redis -
setKey(key, value)
-
Set a key-stringified-value pair in ur store
Parameters:
Name Type Description key
Key to store value under value
JSON value to store within redis -
setKey(key, value)
-
Set a key-stringified-value pair in ur store
Parameters:
Name Type Description key
Key to store value under value
JSON value to store within redis