I have a key that expires after 30 seconds.
redisTemplate.expire(sessionId , 30, TimeUnit.SECONDS);
This is my listener:
@Service
public class RedisController implements MessageListener {
@Override
public void onMessage(Message message, byte[] pattern) {
// Get every expired key from below the code.
String key = new String(message.getBody());
System.out.println("expired key is: " + key);
}
}
I have also set CONFIG SET notify-keyspace-events KEA
, but I am not receiving any callback.