|
|
@ -71,10 +71,16 @@ function getCachedUser(id, cb) { |
|
|
|
Second, node-cache-manager features a built-in memory cache (using [node-lru-cache](https://github.com/isaacs/node-lru-cache)), |
|
|
|
with the standard functions you'd expect in most caches: |
|
|
|
|
|
|
|
set(key, val, ttl, cb) |
|
|
|
set(key, val, {ttl: ttl}, cb) // * see note below |
|
|
|
get(key, cb) |
|
|
|
del(key, cb) |
|
|
|
|
|
|
|
// * Note that depending on the underlying store, you may be able to pass the |
|
|
|
// ttl as the third param, like this: |
|
|
|
set(key, val, ttl, cb) |
|
|
|
// ... or pass no ttl at all: |
|
|
|
set(key, val, cb) |
|
|
|
|
|
|
|
Third, node-cache-manager lets you set up a tiered cache strategy. This may be of |
|
|
|
limited use in most cases, but imagine a scenario where you expect tons of |
|
|
|
traffic, and don't want to hit your primary cache (like Redis) for every request. |
|
|
|