Closed stockholmux closed 6 years ago
That's a good question @stockholmux. Redis will never emit such protocol, however probably better for the client to be resistant to such cases, by avoiding re-adding the same element again. A good example on how that could be potentially useful is if we would reply with a Set reply to SCAN
. The command is unable to guarantee unicity, yet the returned keys are not ordered in any way. I'll add a section about it, thanks.
@stockholmux fixed hopefully.
Perfect. So, in this case this maps nicely to Javascript sets:
const set1 = new Set();
set1.add(42);
set1.add(42);
set1.add(13);
for (let item of set1) {
console.log(item);
// expected output: 42
// expected output: 13
}
My only concern would be a module that emits a non-unique set.
Yes could happen and better for it to be valid at protocol level. Trivial case: module that emits N random numbers.
Looking at the set replies, can you have non-unique items?
Example - is this valid?