ioredis-mock

Emulates ioredis by performing all operations in-memory.

MIT License

Downloads
2.8M
Stars
326
Committers
91

Bot releases are hidden (Show)

ioredis-mock - v4.1.1

Published by stipsan about 6 years ago

4.1.1 (2018-10-16)

Bug Fixes

ioredis-mock - v4.1.0

Published by stipsan about 6 years ago

4.1.0 (2018-10-12)

Features

ioredis-mock - v4.0.0

Published by stipsan about 6 years ago

4.0.0 (2018-10-02)

Features

  • Use native Promise, but allow overriding it (#561) (c3ece9f)

BREAKING CHANGES

  • Native promises replaces Bluebird to correspond with ioredis v4. This change is not backwards compatible and we're updating the peerDependency accordingly. You can switch the Promise implementation in ioredis-mock as in ioredis:
const Redis = require('ioredis-mock')
Redis.Promise = require('bluebird')

const redis = new Redis()
ioredis-mock - v3.14.3

Published by stipsan about 6 years ago

3.14.3 (2018-09-14)

Bug Fixes

  • Support WITHSCORES in zrange (7006aac)
ioredis-mock - v3.14.2

Published by stipsan about 6 years ago

3.14.2 (2018-09-08)

Bug Fixes

ioredis-mock - v3.14.1

Published by stipsan about 6 years ago

3.14.1 (2018-08-30)

Bug Fixes

  • release: a release should've been triggered by #546 (50a57a7)
ioredis-mock - v3.14.0

Published by stipsan about 6 years ago

3.14.0 (2018-08-25)

Features

ioredis-mock - v3.13.1

Published by stipsan about 6 years ago

3.13.1 (2018-08-14)

Bug Fixes

  • deps: update dependency ioredis to v4 (#532) (577527b)
ioredis-mock - v3.13.0

Published by stipsan about 6 years ago

3.13.0 (2018-08-06)

Features

ioredis-mock - v3.12.1

Published by stipsan about 6 years ago

3.12.1 (2018-08-04)

Bug Fixes

ioredis-mock - v3.12.0

Published by stipsan about 6 years ago

3.12.0 (2018-07-25)

Features

  • add support for array of commands to pipeline() (#463) (6d1489f)
ioredis-mock - v3.11.0

Published by stipsan over 6 years ago

Added

zcount command (#460 @jmelion)

ioredis-mock - v3.10.2

Published by stipsan over 6 years ago

  • Fixed: Closer mock of pipeline/multi feature (#458 @BastienAr)
ioredis-mock - v3.10.1

Published by stipsan over 6 years ago

  • Fixed: redis format for xread for multiple streams. (#455 @critocrito)
ioredis-mock - v3.10.0

Published by stipsan over 6 years ago

Added

xadd, xlen, xrange, xrevrange and xread for stream support (#449 @critocrito)

Support basic stream operations (https://redis.io/topics/streams-intro) for
the upcoming Redis 5 release. Some features are missing, such as consumer
groups, capped streams or some of the auxiliary commands.

Event ids are auto incremented integers in the form of 1-0, 2-0,
etc. Events are stored internally as an array of arrays and for every event an
additional record is kept whether the event has been already polled or not.

const redis = new MockRedis({
  mystream: [
    ["1-0", ["key1", "val1", "key2", "val2"]],
    ["2-0", ["key1", "val1", "key2", "val2"]]
  ],
  "stream:mystream:1-0": {polled: false},
  "stream:mystream:2-0": {polled: false},
})

To poll events in a blocking manner is supported and the poll happens every
100ms.

// This will resolve once a new event becomes available.
redis.xread("BLOCK", "0", "STREAMS", "mystream", "$").then(console.log);
// After 1 second add a new event, that will resolve the waiting `XREAD`
// command.
setTimeout(() => redis.xadd("mystream", "*", "key", "val"), 1000);

ioredis doesn't support Redis streams yet, but there is pull request for redis-commands to add support. In the meantime ioredis' createBuiltinCommand can be used to add support manually:

import Redis from "ioredis";

const {string: xadd} = Redis.prototype.createBuiltinCommand("xadd");
const {string: xread} = Redis.prototype.createBuiltinCommand("xread");
Redis.prototype.xadd = xadd;
Redis.prototype.xread = xread;
const redis = new Redis();
ioredis-mock - v3.9.1

Published by stipsan over 6 years ago

  • Fixed: zrange functions sort items with the same score in lexicographical order (#446 @kylewm)
ioredis-mock - v3.9.0

Published by stipsan over 6 years ago

Added

  • zrevrangebyscore commands (#442 @kylewm)
  • zrem and zincrby commands (#443 @kylewm)
ioredis-mock - v3.8.3

Published by stipsan over 6 years ago

  • Fixed: missing case in spop (#433 @BastienAr)
ioredis-mock - v3.8.2

Published by stipsan over 6 years ago

  • Fixed: spop behaviour (#432 @BastienAr)
ioredis-mock - v3.8.1

Published by stipsan over 6 years ago

  • Fixed: flatten (smoosh) args correctly (#405 @BastienAr)