Client tracking
Client tracking listener is invoked when an invalidation message is received if the data previously requested has been changed. Next listener invocation will be made only if a new data request has been made and another change has occurred since then.
Available for RBucket, RStream, RSet, RMap, RScoredSortedSet, RList, RQueue, RDeque, RBlockingQueue, RBlockingDeque, RDelayedQueue, RRingBuffer objects.
Requires protocol setting value set to RESP3
.
Code usage example.
RBucket<String> b = redisson.getBucket("test");
int listenerId = b.addListener(new TrackingListener() {
@Override
public void onChange(String name) {
// ...
}
});
// data requested and change is now tracked
b.get();
// ...
// stop tracking
b.removeListener(listenerId);
Flush listener
Flush listener is executed on flushall/flushdb commands execution.