@bustle/redis-loader

7.0.0 • Public • Published

RedisLoader

An ioredis-like object that batches commands via dataloader. Under the hood we have dataloader utilize redis's multi transactions and pipelining to group commands called. We also support batching in streams.

Installation

npm i --save @bustle/redis-loader

or

yarn add @bustle/redis-loader

Examples

// RedisLoader supports an optional logger function with stats on each batch of commands
function logger (stats) {
  //...
}
// set up like you would `ioredis`
const redis = redisLoader('redis://localhost:6379/1', { keyPrefix: 'foo', logger })

// or setup ioredis
const redis = new Redis(redisUrl, redisOptions)
const redisLoader = new RedisLoader({ redis, logger })

// three commands sent to Redis together in one multi
await Promise.all([
  redis.ping(),
  redis.dbsize(),
  redis.time()
])

// three commands sent separately to redis
await redis.ping()
await redis.dbsize()
await redis.time()

Package Sidebar

Install

npm i @bustle/redis-loader

Weekly Downloads

8

Version

7.0.0

License

MIT

Unpacked Size

45 kB

Total Files

13

Last publish

Collaborators

  • eggplantkiller
  • tholman
  • teety
  • tylerlove
  • zeejab
  • anujpan
  • gdub
  • bustle-deploy
  • redterror
  • wabyad
  • sarahganis
  • cg3ntry