stewart99
stewart99

Reputation: 15064

Redis SPOP not atomic?

Reading the documentation it doesn't look like Set POP (SPOP) is atomic, where as LPOP and RPOP, etc are. This is also what I'm seeing with my code where I have two clients using lettuce and reactive streams listening for SPOP. When something is pushed, both clients get the same value that was just pushed. I was really hoping to avoid that because I need a set to keep my values unique and was hoping SPOP would be identical to LPOP.

I have a pubsub client that pushes to this Set, and multiple instances will have multiple pubsub clients, which is why the Set to prevent extra work from being done.

I can either make sure list only contains unique items or I can make SPOP atomic. How should I go about doing this?

Upvotes: 1

Views: 1251

Answers (1)

stewart99
stewart99

Reputation: 15064

There is someone else who explains why SPOP isn't atomic:

https://medium.com/@stockholmux/redis-spop-culture-800cf306cbe6

Upvotes: 0

Related Questions