miniredis icon indicating copy to clipboard operation
miniredis copied to clipboard

Support of keyspace events

Open boahwas opened this issue 4 years ago • 7 comments

Maybe I didnt get it but when is use miniredis instead of go-redis and listening to the keypace events like:

client := redis.NewClient(&redis.Options{
Addr: s.Addr(),
})
client.ConfigSet("notify-keyspace-events", "Kx")
...
sub := client.PSubscribe("__keyspace@0__:" + key)
_ = <-sub.Channel()

Do I get a notification on the channel when a key expires

when i call s.FastForward(x) in my tests

(in go-redis everything works as expected)

thanks for your time

boahwas avatar Dec 16 '20 17:12 boahwas

Hi,

thanks for your issue.

sub := client.PSubscribe("keyspace@0:" + key)

miniredis doesn't have support for that currently. I'll have a look soon-ish.

alicebob avatar Dec 17 '20 08:12 alicebob

Found the docs: https://redis.io/topics/notifications

yes, there is no support for that right now. Doesn't seem impossible to add, but it's a lot of events. Which events are you most interested in? Mostly the x (expired) events?

alicebob avatar Dec 23 '20 11:12 alicebob

For now I would be fine with the expired events. ^^

boahwas avatar Dec 23 '20 11:12 boahwas

@alicebob Is this in pipeline, I'd like to contribute if not.

sperahd avatar May 29 '21 09:05 sperahd

On Sat, May 29, 2021 at 02:04:23AM -0700, Ankit Prakash wrote:

@alicebob Is this in pipeline, I'd like to contribute if not.

I'm not working on it, so a PR would be appreciated!

alicebob avatar May 30 '21 14:05 alicebob

has there been any progress on this? I'm also looking to use a feature like this in my tests as I use redis to subscribe to expired events

walkerobrien avatar Jan 15 '24 18:01 walkerobrien

On Mon, Jan 15, 2024 at 10:49:39AM -0800, walkerobrien wrote:

has there been any progress on this? I'm also looking to use a feature like this in my tests as I use redis to subscribe to expired events

Hi, no, no progress. It's a big change and no-one needed badly enough yet to start with it :)

alicebob avatar Jan 16 '24 08:01 alicebob