In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
| A hash consists of multiple field value pairs (field-value pair). The fields and values of the hash can be text, integer, floating point or binary data. # each field in the same hash must be unique, while the values of different fields can be duplicated. # Action: set the domain value pair, get the value of the field, and check whether the field exists | basic operation-associate the field value pair hset key field value # associate the given domain value pair field and value in the hash key key # if the domain field has not been associated with the value before, then the command returns 1; # if the domain field is already associated with the value, then the command overwrites the old value with the new value and returns 0. -- gets the value associated with the domain hget key field # returns the value associated with the domain field lock in the hash key key. If the domain field has no associated value, then return nil-- only if the domain does not exist, the associated domain value is for hsetnx key field value # if the hash key key, the domain field does not exist, then associate the given domain value for field and value # if the domain field already has a value associated with it, then the command does not do the action redis > hsetnx message 'content'' good morningjackpacking' (integer) 1 redis > hsetnx message 'content'' good morning, jackpot'# No action, no modification (integer) 0mi-check whether the domain exists hexists key field # View the hash key key, whether the given field field exists: there is a return 1, there is no return 0-delete a given field value for hdel key field [field...] # Delete one or more specified fields in the hash key key And the values of those fields. # domains that do not exist will be ignored, and the command returns the number of domain value pairs that have been successfully deleted. -- get the number of key-value pairs contained in the hash hlen key # return the number of field-value pairs contained in the hash key key > hlen message (integer) 4 | batch operation-- set or get multiple field-value pairs in the hash at once or get hmset key field value [field value...] # in the hash key key associate multiple pairs with the hmget key field [field...] # return the hash key key Values of one or more fields-get all fields, values, or field values contained in the hash key hkeys key returns all fields contained in the hash key key return values of all fields in the hash key key hgetall key returns all field value pairs contained in the hash key key # Why is the command called hkeys instead of hfields? For hashing, key and field mean the same thing, and key is easier to spell than field, so Redis chooses to use hkeys as the name of the command instead of hfields. | | numeric operation-perform a self-increment operation on the value of the field hincrby key field increment # which integer increment is the value of the domain field? increment hincrbyfloat key field increment # 9 add the floating point increment increment in the value of the domain field # although Redis does not provide the corresponding hdecrby and hdecrbyfloat commands, we can also # subtract by setting the increment to a negative number redis > hincrby numbers x 100 # the field does not exist | Initialize the value to 0, (integer) 100, and then perform the hincrby operation redis > hincrby numbers x-50 # to pass in a negative value, and subtract (integer) 50 redis > hincrbyfloat numbers x 3.14 # floating point calculation '53.14'
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.