In-memory cache implementing a subset of the node-redis API - specifically the get, set, setex, exists, del, flushall, and ttl commands. Like node_redis, all commands can take an optional
callback as the final argument.
This cache isn't really intended for production scenarios, but is suitable for use in place of
node_redis for development environments and unit tests.
In addition to the subset of the built-in Redis commands, there are 3 additional functions:
writeThrough that are used to stream data into and out of the cache. Although these are purely for backwards API compatibility since the cached strings are already in memory.
For the real Redis, checkout the redis-streams package augments
RedisClient with these same functions.
npm install memory-cache-stream
var memoryCache = ;// Set with ttl of 1 minutememoryCache;// Get using a callbackmemoryCache;// Pipe out of the cachememoryCache;// Pipe into a cachefs;// Pipe into the cache and through to stdoutfs;
See the unit tests for additional examples.