stipsan / ioredis-mock

Emulates ioredis by performing all operations in-memory.
MIT License
333 stars 125 forks source link

feat: add `watch` and `unwatch` commands #1347

Open MiniGod opened 3 months ago

MiniGod commented 3 months ago

I tried following the style of the rest of the repo. All tests are passing. E2E too.

The one thing I'm least confident about is the event emitter I used to let the "client" know about changed keys to track changed keys. If you have a better solution for it, let me know. A side-effect of using an event emitter like I did, is that a lot of tests emit a warning about the number of listeners since the same context is used in many tests, but the Redis instances are not always disconnected, so the clients pile up.

Solves #1334