Redis-set type operation

Source: Internet
Author: User

Set type operation
Set Operation:
Sadd:sadd key value adds an element to the specified key and returns 0 repeatedly to indicate that the add failed
Srem:srem key value deletes the specified value within key
Spop:spop key randomly deletes a value within the key
Smove:smove Key1 Key2 Value adds the value in the Key1 to the Key2

Collection operation:
sdiff:        Sdiff key1 key2         returns elements of Key1 in the difference set of Key1 and Key2
sdiffstore:    sdiffstore key1 key2 key3     The differential set to be returned exists within the Key3
sinter:        sinter key1 key2         return intersection of Key1 and Key2
sinterstore:    sinterstore key1 key2 key3    The intersection exists within the Key3
sunion:        sunion key1 key2         Key1 and Key2
sunionstore:    sunionstore key1 key2 key3    will exist in Key3

Query operation:
Smembers:smembers key Query Key all values
Scard:scard Key returns the number of values in key
Sismember:sismember key value queries for the existence of value within key
Srandmember:srandmember randomly returns a value of key

Redis-set type operation

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.