Redis Learning Note (13)--redis Common operating instructions (iv)

Source: Internet
Author: User
Tags hash redis
Hash Hash common Operation instruction

The hash keeps the mode of the KV key pair unchanged, but V is a key-value pair
Hset key field value

Set the value of the Field field in hash table key to value

Hget key Field

Gets the value of field in key

Hmset key field value [field value]

Set multiple field value key-value pairs at once

Hmget key field [field]

Gets the value of more than one field in the specified key at once

Hgetall Key

Gets all the field and corresponding values under the specified key

Hdel key field [Fiedl]

You can delete more than one field at once

Hlen Key

Gets the length of the specified key

Hexists key Field

Finds the value of a field in the specified hash table

Hkeys Key

View all field in a given hash table

Hvals Key

View all values in a given hash table

Hincrby key Field Step

Adds a step (integer) to the given value, defines a hash structure, and the key is the customer field, including the Age name address


You can see that the age has changed from 24 to 25.

Hincrbyfloat key Field Step

Adds a floating-point number to a given value

Give age plus 0.5, you can see the result becomes 25.5

Hsetnx key field value

If there is no corresponding field in the given key, a new key value pair is added to enter

Because the previous hash table already exists in the age, so the setup failed, no email, we set the email success

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.