Redis supports five basic data type commands: string (SET/GET/INCR/DECR/APPEND/STRLEN) hash (HSET/HGET/HDEL/HLEN/HGETALL) list (LPUSH/RPUSH/LPOP /RPOP/LLEN/LRANGE) set (SADD/SMEMBERS/SREM/SCARD/SINTER/SUNION) ordered set (ZADD/ZSCORE/ZRANGE/ZRANK/ZCARD)
Five data type commands of Redis
Redis is an open source in-memory database that supports five basic data types: string, hash, list, set and ordered gather. The following are the commands for these five data types:
String
- SET: Set the value of the string
- GET: Get the character The value of the string
- INCR/DECR: Atomic increase/decrease the value of the string
- APPEND: Append content at the end of the string
- STRLEN: Get the length of the string
Hash
- HSET/HGET: Set/get the key-value pair in the hash
- HDEL: Delete the hash of key-value pairs
- HLEN: Get the number of key-value pairs in the hash
- HGETALL: Get all the key-value pairs in the hash
List
- LPUSH/RPUSH: Push elements at the head/tail of the list
- LPOP/RPOP: Pop elements from the head/tail of the list
- LLEN: Get the number of elements in the list
- LRANGE: Get the elements in the specified range in the list
Collection
- SADD: Add elements to the set
- SMEMBERS: Get all elements in the set
- SREM: Remove elements from the set
- SCARD: Get the number of elements in the set
- SINTER/SUNION: Find the intersection/union of sets
Ordered set
- ZADD: Add elements to in the ordered set, and specify its score
- ZSCORE: Get the score of the element in the ordered set
- ZRANGE: Get the element within the specified score range in the ordered set
- ZRANK : Get the ranking of elements in an ordered set
- ZCARD: Get the number of elements in an ordered set
The above is the detailed content of What are the five data type commands of redis. For more information, please follow other related articles on the PHP Chinese website!