I am using RMapCache
where setMaxSize is set.
Can someone tell me if there is a way for me to know in EntryRemovedListener if the entry is evicted (due to maxSize
being reached) or if the removal is due to the explicit call of remove()
?
The only way I can think of is the one below, but I’m not sure how accurate this will be or whether this is even recommended.
map.addListener(
(EntryRemovedListener<String, V>)
event -> {
if (event.getSource().size == maxSize) {
log.info("Entry evicted due to max size being reached");
}
});
Can someone suggest if the above is recommended or if a better approach exists?
Redisson Version – 3.32.0