Can I manage redis notifications with Lettuce? I can't find any example or doc on it. I simply need to have some notification/callback in my java code when elements expire in Redis.
Let me put an example... I'm sorry, reading the Lettuce doc won't help me (and I I've taken some time)
Imagine I have a namespace of objects where I execute get and set commands:
"ONLINEUSERS:userid"
I add a user that will expire in an hour:
syncCommands.setex("ONLINEUSERS:"+userid,3600, mapper.writeValueAsString(userObject));
How can I have a method in my java code executed after those 3600 seconds make the key expire?
I mean... In the doc, the commands are:
StatefulRedisPubSubConnection<String, String> connection = client.connectPubSub()
connection.addListener(new RedisPubSubListener<String, String>() { ... })
RedisPubSubAsyncCommands<String, String> async = connection.async();
RedisFuture<Void> future = async.subscribe("channel");
// application flow continues
What would be the values for String, String array and "channel" parameter matching my expire event for my key namespace?