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

Type of Redis-hash

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Commands related to hash data types

1Drom hset command

127.0.0.1 purl 6379 > hset user name yuhao

(integer) 1

127.0.0.1 6379 > hset user age 19

(integer) 1

127.0.0.1 purl 6379 > hset user from qinghai

(integer) 1

127.0.0.1 purl 6379 > hgetall user

1) "name"

2) "yuhao"

3) "age"

4) "19"

5) "from"

6) "qinghai"

2meme hmset sets multiple values

127.0.0.1 6379 > hmset user1 name gss age 19

OK

View a column of values

127.0.0.1 purl 6379 > hget user1 name

"gss"

View all

127.0.0.1 purl 6379 > hgetall user1

1) "name"

2) "gss"

3) "age"

4) "19"

3, delete a value

127.0.0.1 purl 6379 > hdel user1 age

(integer) 1

127.0.0.1 purl 6379 > hget user1 age

(nil)

4, statistics

127.0.0.1 purl 6379 > hlen user

(integer) 3

127.0.0.1 purl 6379 > hlen user1

(integer) 1

5. Determine whether the value in key exists.

127.0.0.1 purl 6379 > hexists user name

(integer) 1

127.0.0.1 purl 6379 > hexists user1 age

(integer) 0

6. View all hash

127.0.0.1 purl 6379 > hkeys user

1) "name"

2) "age"

3) "from"

127.0.0.1 purl 6379 > hkeys user1

1) "name"

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

Database

Wechat

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

12
Report