DiceDB / dice

DiceDB is a redis-compliant, reactive, scalable, highly-available, unified cache optimized for modern hardware.
https://dicedb.io/
Other
6.83k stars 1.08k forks source link

Adds support for SMEMBERS.WATCH command #1289

Open superiorsd10 opened 5 days ago

superiorsd10 commented 5 days ago

This PR implements the feature described in the issue #1132. The new SMEMBERS.WATCH command allows subscribed clients to receive push responses whenever the data in a respective set is modified.


Changed Introduced


Why did I modified the evalSADD function

I have had to modify this function because the subscribers were receiving double notifications for the first SADD command. The old implementation caused double notifications because it performed a store.PUT for the initial set creation and subsequent additions. The new implementation defers the store.PUT operation until all additions are complete, ensuring subscribers are notified only once.

Why Sorting the Results in Integration Tests Is Necessary

To validate the correctness of the reactive system, we care about the contents and not the order of the set. Sorting both the expected and received results allows us to


Screenshot

SCR-20241116-q7s