ioredis-mock icon indicating copy to clipboard operation
ioredis-mock copied to clipboard

Keyspace Notifications are missing

Open Parcley opened this issue 6 years ago • 2 comments

this testcase should pass:

describe('keyspaceNotifications', () => {
  it('should appear when configured and the triggering event occurs', (done) => {
    const redis = new MockRedis({notifyKeyspaceEvents: 'gK'}); // gK: generic keyspace
    redis.on('message', (channel, message) => {
      expect(channel).toBe('__keyspace@0__:key');
      expect(message).toBe('del');
      done();
    });
    redis.set('key', 'value')
    .then(() => redis.del('key'));
  });
});

suggestion: pass notifiy-keyspace-events configuration to MockRedis constructur (actually, this is a redis-server configuration value) see https://redis.io/topics/notifications

If interested, I am working on this (at least for some of the many keyspace notification events)

Parcley avatar Jan 11 '19 14:01 Parcley

PR's welcome for sure 🙂

stipsan avatar Jan 11 '19 14:01 stipsan

see PR #658

Parcley avatar Jan 11 '19 16:01 Parcley