Home > Database > Redis > body text

What are the five data type commands of redis

下次还敢
Release: 2024-04-07 10:15:20
Original
418 people have browsed it

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)

What are the five data type commands of redis

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template