@kgs-research/redis-utils

1.0.1 • Public • Published

Redis Utilities

Utilities for Redis functionality

MessageStream

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();

MessageQueue

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();

Readme

Keywords

none

Package Sidebar

Install

npm i @kgs-research/redis-utils

Weekly Downloads

14

Version

1.0.1

License

ISC

Unpacked Size

11.3 kB

Total Files

9

Last publish

Collaborators

  • dilshang
  • kgs-ben