Home  >  Article  >  Database  >  What are the related commands of redis collection?

What are the related commands of redis collection?

藏色散人
藏色散人Original
2020-07-01 09:54:422391browse

The related commands of the redis collection are: 1. "SADD", call the intsetAdd function to add all new elements to the integer collection; 2. "SCARD", call the intsetLen function to return the elements contained in the integer collection Quantity; 3. "SISMEMBER" command and so on.

What are the related commands of redis collection?

Implementation method of collection command

Command Intset encoding implementation method hashtable encoding implementation method
SADD Call the intsetAdd function to All new elements are added to the integer collection Call dictAdd, with the new element as the key and NULL as the value, and add the key-value pair to the dictionary
SCARD Call the intsetLen function to return the number of elements contained in the integer set. This number is the number of elements contained in the collection object. Call the dictSize function to return the number of key-value pairs contained in the dictionary. This number is The number of elements contained in the collection object
SISMEMBER Call the intsetFind function to find the given element in the integer collection. If the element is found and exists in the collection, it is not found. It means that the element does not exist in the set Call the dictFind function to find the given element in the key of the dictionary. If it is found, it means that the element exists in the set. If it is not found, it means that the element does not exist in the set.
SMEMBERS Traverse the entire integer collection, call the inisetGet function to return the collection elements Traverse the entire dictionary, use the dictGetKey function to return the dictionary key as the collection element
SRANDMEMBER Call the intsetRandom function to randomly return an element from the integer collection Call the dictGetRandomKey function to randomly return a dictionary key from the dictionary
SPOP Call the intsetRandom function to randomly remove an element from the integer collection. After returning this random element to the client, call the intsetRemove function to delete the random element from the integer collection. Call the dictGetRandomKey function to randomly extract a dictionary key from the dictionary. After returning the value of this random dictionary key to the client, call the dictDelete function to delete the key-value pair corresponding to the random dictionary key from the dictionary.
SREM Call the intsetRemove function to delete all given elements from the integer collection Call the dictDelete function to delete all keys from the dictionary The key-value pair of a given element

Related learning recommendations:redis tutorial

The above is the detailed content of What are the related commands of redis collection?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn