Redis (2.8.3) command Learning-HASHS

Source: Internet
Author: User

hdel key field [field ...]

Delete one or more hash fields

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hexists book.1 title (integer) 1127.0.0.1:6379> hdel book.1 title (integer) 1127.0.0.1:6379> hexists book.1 title (integer) 0

Hexists key Field

Determine if a hash field exists

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 1127.0.0.1:6379> hexists book.1 title (integer) 1127.0.0.1:6379> hexists book.1 title2 (integer) 0127.0.0.1:6379> hexists book.2 title (integer) 0

Hget key Field

Get the value of a hash field

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 1127.0.0.1:6379> hget book.1 title "HelloWorld" 127.0.0.1:6379> hget book.1 Author "mr.404"

Hgetall Key

Get all the fields and values in a hash

127.0.0.1:6379>  hset book.1 title HelloWorld (integer) 1127.0.0.1:6379> hset book.1 author mr.404 (integer) 1127.0.0.1:6379> hgetall book.11) "title" 2) "HelloWorld" 3) "author" 4) "mr.404"

Hincrby key field Increment

Increment the integer value of a hash field by the given number

127.0.0.1:6379> hset book.1 Price (integer) 1127.0.0.1:6379> hincrby book.1 Price (integer) 40127.0.0.1:6379& Gt Hincrby Book.1 price-5
(integer) 35

Hincrbyfloat key field Increment

Increment the float value of a hash field by the given amount

127.0.0.1:6379> hset book.1 Price (integer) 0127.0.0.1:6379> hincrbyfloat book.1 price 9.99 "39.99" 127.0.0.1:6379> hincrbyfloat book.1 price-4.5 "35.49"

Hkeys Key

Get all the fields in a hash

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 0127.0.0.1:6379> hkeys book.11) "title" 2) "Author"

Hlen Key

Get the number of fields in a hash

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 0127.0.0.1:6379> hlen book.1 (integer) 2


Hmget key field [field ...]

Get the values of all the given hash fields

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 0127.0.0.1:6379> hmget book.1 author Title1) "mr.404" 2) "HelloWorld

Hmset key field value [field value ...]

Set multiple hash fields to multiple values

127.0.0.1:6379> Hmset book.1 title HelloWorld author mr.404ok127.0.0.1:6379> hget book.1 title "HelloWorld" 127.0.0.1:6379> hget book.1 Author "mr.404"

Hset key field value

Set the string value of a hash field

127.0.0.1:6379> hset book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 1127.0.0.1:6379> hget book.1 title "HelloWorld" 127.0.0.1:6379> hget book.1 Author "mr.404"

Hsetnx key field value

Set the value of a hash field, only if the field does not exist

127.0.0.1:6379> hsetnx book.1 title HelloWorld (integer) 1127.0.0.1:6379> hsetnx book.1 title Hellopython (integer) 0127.0.0.1:6379> hget book.1 title "HelloWorld"

Hstrlen key Field

Get the length of the value of a hash field

More:http://redis.io/commands/hstrlen

Hvals Key
Get all the values in a hash

127.0.0.1:6379> hsetnx book.1 title HelloWorld (integer) 0127.0.0.1:6379> hset book.1 author mr.404 (integer) 1127.0.0.1:6379> hvals book.11) "HelloWorld" 2) "mr.404"

HSCAN key cursor [MATCH pattern] [count Count]

Incrementally iterate hash fields and associated values

More:http://redis.io/commands/hscan, http://www.redis.cn/commands/hscan.html

Redis (2.8.3) command Learning-HASHS

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.