Utilities for Redis functionality
To update the module on npm:
- Ensure
package.json
's version number has been incremented. - Checkout the main branch
- Pull and update the main branch
npm run publish
to publish the package to npm.
Stream for publishing and consuming data using redis
const stream = new MessageStream('testing');
await stream.connect();
await stream.addMessage({ hello: 'world' });
let { message } = await stream.consumeMessage();
console.log(message); // { hello: 'world' }
await disconnect();
A redis implementation of a queue
let queue = new MessageQueue('testing');
await queue.connect();
await queue.push({ someKey: 'Some data' });
while (await queue.size()) {
console.log(await queue.pop()); // { someKey: 'Some data' }
}
await queue.disconnect();