Redis 哈希(Hash)
来源:互联网 发布:淘宝达人在哪里登录 编辑:程序博客网 时间:2024/06/12 01:09
Redis 哈希(Hash)
Redis hash 是一个string类型的field和value的映射表,hash特别适合用于存储对象。
Redis 中每个 hash 可以存储 232 - 1 键值对(40多亿)。
实例
127.0.0.1:6379> HMSET runoobkey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000OK127.0.0.1:6379> HGETALL runoobkey1) "name"2) "redis tutorial"3) "description"4) "redis basic commands for caching"5) "likes"6) "20"7) "visitors"8) "23000"
在以上实例中,我们设置了 redis 的一些描述信息(name, description, likes, visitors) 到哈希表的 runoobkey 中。
Redis hash 命令
下表列出了 redis hash 基本的相关命令:
删除一个或多个哈希表字段2HEXISTS key field
查看哈希表 key 中,指定的字段是否存在。3HGET key field
获取存储在哈希表中指定字段的值。4HGETALL key
获取在哈希表中指定 key 的所有字段和值5HINCRBY key field increment
为哈希表 key 中的指定字段的整数值加上增量 increment 。6HINCRBYFLOAT key field increment
为哈希表 key 中的指定字段的浮点数值加上增量 increment 。7HKEYS key
获取所有哈希表中的字段8HLEN key
获取哈希表中字段的数量9HMGET key field1 [field2]
获取所有给定字段的值10HMSET key field1 value1 [field2 value2 ]
同时将多个 field-value (域-值)对设置到哈希表 key 中。11HSET key field value
将哈希表 key 中的字段 field 的值设为 value 。12HSETNX key field value
只有在字段 field 不存在时,设置哈希表字段的值。13HVALS key
获取哈希表中所有值14HSCAN key cursor [MATCH pattern] [COUNT count]
迭代哈希表中的键值对。
阅读全文
0 0
- 【Redis】----Redis哈希(Hash)
- Redis 哈希(Hash)
- Redis Hash(哈希)
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- Redis[三] @Hash 哈希
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- Redis 哈希(Hash)
- redis 哈希hash
- Redis-数据结构(哈希hash)
- redis hash
- redis ,hash
- redis Hash
- Redis-Hash
- mybatis入门基础(五)----动态SQL
- Lecture 7_2: Lists and mutability, dictionaries, pseudocode, introduction to efficiency
- 算法分析与设计课程——LeetCode刷题之Reverse Integer
- wr720n v4 折腾笔记(二):刷入不死Uboot
- urllib异常处理中HTTPError和URLError混用的注意事项
- Redis 哈希(Hash)
- JSTL, EL 获取数据和遍历
- mybatis入门基础(六)----高级映射(一对一,一对多,多对多)
- 第一单元作业
- Spring Boot 部署与服务配置详解
- Redis 列表(List)
- Lecture 8: Complexity; log, linear, quadratic, exponential algorithms
- POJ 2187 平面最远点对 凸包入门
- object对象重写equals方法时为什么需要重写hashCode方法