Efficient way redis set member update

前端 未结 1 456
耶瑟儿~
耶瑟儿~ 2020-12-21 22:38

I have a redis set. This set can store 20 members maximum(added withSADD command). My problem is ; I need to update that members when needed. Members need that

相关标签:
1条回答
  • 2020-12-21 23:33

    Set members themselves are immutable - you can add new members or remove existing ones. That's it.

    Given that a set is an unordered collection of unique members, consider the possible outcomes were set members theoretically modifiable when the new value for a member:

    1. is identical to the old value - no change to the set
    2. already exists in the set - equivalent to deleting that member
    3. isn't 1 or 2 - equivalent to deleting the member and adding a new one
    0 讨论(0)
提交回复
热议问题