缓存技术Redis之Hash类型详解

《缓存技术Redis之Hash类型详解》要点:
本文介绍了缓存技术Redis之Hash类型详解,希望对您有用。如果有疑问,可以联系我们。

简介

Hash是String类型的filed和value的映射表.更适合用来存储对象,相对于每个属性都存成String类型,将一个对象存储在hash类型中,更省内存并且便于存取.

办法

Hset 设置hash的filed为定值,如果key不存在则创立,如果存在则更新.Hset key filed value

缓存技术Redis之Hash类型详解

Hsetnx 设置hash的filed为定值,如果key不存在则创立返回1,如果存在也无法更新返回0. hsetnx key field value

缓存技术Redis之Hash类型详解

Hmset 同时设置hash的多个filed hmset key field value [field value ...]

Hmget 同时获取多个filed hmget key field [field ...]

缓存技术Redis之Hash类型详解

Hincrby 给filed加定值,但是必需是整数 hincrby key field increment

缓存技术Redis之Hash类型详解

Hexists 断定filed是否存在 hexists key field

缓存技术Redis之Hash类型详解

Hlen 返回hash的filed数目hlen key

缓存技术Redis之Hash类型详解

Hdel 删除了hash指定的filed hdel key field [field ...]

缓存技术Redis之Hash类型详解

Hkeys 返回hash所有的filed hkeys key

缓存技术Redis之Hash类型详解

hvals:返回hash的所有valuehvals key

缓存技术Redis之Hash类型详解

Hgetall 返回hash的所有filed以及value

缓存技术Redis之Hash类型详解

欢迎参与《缓存技术Redis之Hash类型详解》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。

相关文章

文章浏览阅读1.3k次。在 Redis 中,键(Keys)是非常重要的概...
文章浏览阅读3.3k次,点赞44次,收藏88次。本篇是对单节点的...
文章浏览阅读8.4k次,点赞8次,收藏18次。Spring Boot 整合R...
文章浏览阅读978次,点赞25次,收藏21次。在Centos上安装Red...
文章浏览阅读1.2k次,点赞21次,收藏22次。Docker-Compose部...
文章浏览阅读2.2k次,点赞59次,收藏38次。合理的JedisPool资...