Is it possible to set a listener in Redis which is triggered when an item (value/key) is inserted in Redis or when an value is changed? I researched library Jedis and Redisson, but found nothing.
Redis has various Java clients you can use. However, for this tutorial, we will use Lettuce. Lettuce is a free, open-source, thread-safe Redis client that is easy to configure. It provides synchronous and asynchronous connections to Redis with minimum setup.
RedisMessageListenerContainer is a class provided by Spring Data Redis which provides asynchronous behavior for Redis message listeners. This is called internally and, according to the Spring Data Redis documentation – “handles the low level details of listening, converting and message dispatching.”
Redis is an open-source data structure store that is primarily used as a database, message broker, or cache. We can assume Redis as a No-SQL database that stores in its memory specific key-value pair kind of data thereby supporting persistent data storage as and when required.
Yes, you can do that with Redis' Keyspace Notifications and subscribing to the relevant channels from your Jedis/Redisson clients.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With