Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of Hash in Redis data type operation

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the use of Hash in Redis data type manipulation. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Hset

Format: hset 'name'' key' 'value'

Add an object called name that contains the key-value pair of key-value.

2. Hget

Format: hget 'name'' key'

Gets a value named name object key.

3. Hsetnx

Format: hsetnx 'name'' key' 'value'

Add an object named name. If name already exists, neither add nor modify the original value, and return 0; if it does not exist, add it and return 1.

4. Hmset

Format: hmset 'name'' key1' 'value1'' key2' 'value2'...

Add an object called name with multiple key-value key-value pairs.

5. Hmget

Format: hmget 'name'' key1' 'value1'' key2' 'value2'...

Gets the value values of multiple key named name objects.

6. Hincrby

Format: hincrby 'name'' key' ±{num}

Let the value of the key named name object increase by num, automatically initialize to 0 if it does not exist, and decrease if the num is negative.

7. Hexists

Format: hexists' name' 'key'

Determine whether a key named name object exists.

8. Hlen

Format: hlen 'name'

Gets the number of key named name object.

9. Hdel

Format: hdel 'name'' key1' 'key2'...

Delete the key-value key-value pair named name object.

10. Hkeys

Format: hkeys' name'

Get the names of all key named name objects.

11. Hvals

Format: hvals' name'

Gets all the value values of the object named name.

12. Hgetall

Format: hgetall 'name'

Gets all the key-value values named name objects.

Thank you for reading! This is the end of this article on "what is the use of Hash in the operation of Redis data types". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report