Hash key value pair (hash) for Redis database

Source: Internet
Author: User
Tags redis
hashing (hash)The Hash type in Redis can be seen as a map container with string key and string value. This type is ideal for storing object information. such as the user's username password and so on. Each Hash can store 4,294,967,295 key-value pairs Storage (Hset)

Hset key field Value field does not exist and is stored directly. field exists, performing an overwrite operation.
store multiple key-value pairs (hmset)

Hmset key field Value field value ... field does not exist and is stored directly. field exists, performing an overwrite operation.
Read (Hget)

Hget key Field field does not exist, and the value corresponding to field is read normally. field exists and returns nil.
read multiple values (hmget)

Hmget key Field field ... field does not exist, normal read field corresponds to the value. field exists and returns nil.
Read All (Hgetall)

Hgetall Key

Delete (Hdel)

Hdel key Field field ... The command can delete more than one field at a time, and the return value is the number of deleted fields. field exists, deleting fields, returning the number of deleted fields. field does not exist, returns 0.
Increment (Hincrby)

Hincrby key field Numbervalue increments the specified increment for an integer value, and you can specify that the increment is a negative number to achieve the decrement

determine if a field exists (hexists)

Hexists key Field field exists, returning 1. field does not exist, returns 0.
gets the number of fields in the specified key (Hlen)

Hlen Key
gets all fields of the specified key (Hkeys)

Hkeys Key
gets the value of all fields of the specified key (hvals)

Hvals Key

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.