Redis data type operation (iv)--set

Source: Internet
Author: User

1. Sadd

Format: Sadd ' name ' ' value '

Add value to the set named name.


2. Smembers

Format: smembers ' name '

Returns all the value inside the set named name.


3. Srem

Format: Srem ' name ' ' value '

The value is removed from the set named name.


4. Spop

Format: Spop ' name '

Randomly pops an element from the set named Name, and deletes the element.


5. Sdiff

Format: Sdiff ' name1 ' name2 '

Returns the difference between the set with the name Name1 and the set named Name2. Returns an element in the name2 that is not in name1, as standard with name1.


6. Sdiffstore

Format: Sdiffstore ' name1 ' name2 ' Name3 '

The difference between set with name Name1 and set named Name2 is stored in the set named Name3.


7. Sinter ' name1 ' name2 ' (intersection)

Sinterstore ' name1 ' name2 ' Name3 '


8. Sunion ' name1 ' name2 ' (set)

Sunionstore ' name1 ' name2 ' Name3 '


9. Smove

Format: Smove ' name1 ' name2 ' value '

The value in the set named Name1 is moved to the set named Name2.


Ten. SCard

Format: SCard ' name '

Returns the number of elements in a set named name.


Sismembers.

Format: sismembers ' name ' ' value '

Determines whether the value element is inside a set named name.


Srandmember.

Format: Srandmember ' name '

A random element pops up from a set named name, but does not delete the element.




This article is from the "Bronze Gong" blog, please be sure to keep this source http://jaeger.blog.51cto.com/11064196/1772273

Redis data type operation (iv)--set

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.