In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what commands are commonly used in Redis, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Hash table of Redis common commands
Assignment and selection
Hset key field value
The hset command is used to assign values to the field, and the convenience of the hset command is that it does not distinguish between insert and update operations, which means that when modifying data, you do not have to determine in advance whether the field exists to determine whether the insert operation or update operation is performed, when the insert operation is performed, the hset command returns 1, when the update operation is performed, the hset command returns 0, and when the key itself does not exist, the hset command will automatically establish him.
Hget key field
The hget command is used to get the value of the field and returns nil when the given field does not exist or the given key does not exist.
Hmset key field value [field value. ]
Hmset sets multiple keys and returns OK if the command executes successfully. An error is returned when key is not a hash type.
Hmget key field [field. ]
Hmget gets multiple key values and returns a nil value if the given field does not exist in the hash table. Because a nonexistent key is treated as an empty hash table, a HMGET operation on a nonexistent key returns a table with only nil values. The table values are arranged in the same order as the request order for the given domain parameters.
Hgetall key
Hgetall is used when getting all the fields and field values in the key but does not know which fields are in the key. The result returned is a list of fields and field values.
Determine whether the field exists
Hexists key field
Return 1 if there is, otherwise return 0
Assign when a field does not exist
Hsetnx key field value
The hsetnx command is similar to the hset command, except that the hsetnx command does nothing if the field already exists.
Increase the number
Hincrby key field increment
Increments the field value by the specified integer
Delete a field
Hdel key field [field.]
Delete one or more fields, and the return value is the number of fields deleted.
Get only the field name or field value
Hkeys key
Hkeys gets the names of all fields and returns an empty table when key does not exist.
Hvals key
Hvals gets the values of all the fields in the key and returns an empty table when key does not exist.
Get the number of fields
Hlen key
Gets the number of fields in the hash table. Returns 0 when key does not exist.
About which commands are commonly used in Redis to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.