redis-cache-wrap
Node.js module for wrapping promise results in Redis.
Why?
This module was originally a subset of the Morning Consult Intelligence, but it seemed fit to make it an independent module for other APIs used by Morning Consult. And wrapping promises is easy.
Usage
It wraps promises, stores their results in redis, and only calls the initial function again if the key does not exist.
const cache = prefix: 'foobar:' ex: 1 * 60 * 60 // 1 hour connection: port: processenvREDIS_PORT || 6379 host: processenvREDIS_HOST || 'localhost' ; { return ;} { return cache;} ;