Hash: String元素组成的字典,适合用于存储对象

 

1. select 更换命名空间

select 1

 

2. 设置hash,key为mp,键为name 值为zhangsan  hexists判断hash的key是否存在

Redis hash结构

 

3. 获得map中键为name的值

Redis hash结构

 

4.在设置一个键age,值为20.

hgetall mp获得所有的键值

hkeys mp 获得所有的key值

hvals mp 获得所有的value值

Redis hash结构

 

5. 获得hash里面的数量

Redis hash结构

 

7.hmget获得多个key值

Redis hash结构

 

8. hmset设置多个值

Redis hash结构

 

 9.hdel 删除hash中的key

Redis hash结构

 

相关文章:

  • 2021-06-13
  • 2021-10-28
  • 2021-06-12
  • 2021-08-11
  • 2021-11-07
  • 2021-09-02
  • 2021-06-25
  • 2021-08-02
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2021-06-25
  • 2022-03-09
  • 2021-04-21
相关资源
相似解决方案