杰迪斯 pubsub >> "redis-cli config set notify-keyspace-events Ex " 无法从 conf 文件工作



我们已经实现了jedis.expire事件,并且倾向于使用keyexpiredlistener类的onpMessage方法。

     KeyExpiredListener extends JedisPubSub {
......
public void onPMessage(String pattern, String channel, String message) {....}
....
}

它运作完美当我们设置REDIS CLI。

redis-cli config set notify-keyspace-events Ex

但是,正如预期的那样,如果我们重新启动Redis服务器,则事件侦听器将重新切换为默认值,没有捕获与设置相同的事件。

redis-cli config set notify-keyspace-events ""

因此,我们尝试将其设置在redis.conf文件中,但它不起作用,即不捕获任何事件。

总结,如果我们在CLI

中设置
config set notify-keyspace-events Ex

它有效,如果我们设置在conf file(redis.conf)

notify-keyspace-events Ex

它不起作用。

谢谢!

使用conf dir -

启动redis
./redis-server <path of redis.conf> &

现在(Notify-keyspace-events ex)将在redis.conf。

中提到

最新更新