HDEL key field [field ...]

Delete one or more hash fields

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HEXISTS book.1 title
(integer) 1
127.0.0.1:6379> HDEL book.1 title
(integer) 1
127.0.0.1:6379> HEXISTS book.1 title
(integer) 0

More: http://redis.io/commands/hdelhttp://www.redis.cn/commands/hdel.html

HEXISTS key field

Determine if a hash field exists

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 1
127.0.0.1:6379> HEXISTS book.1 title
(integer) 1
127.0.0.1:6379> HEXISTS book.1 title2
(integer) 0
127.0.0.1:6379> HEXISTS book.2 title
(integer) 0

More: http://redis.io/commands/hexistshttp://www.redis.cn/commands/hexists.html

HGET key field

Get the value of a hash field

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 1
127.0.0.1:6379> HGET book.1 title
"helloworld"
127.0.0.1:6379> HGET book.1 author
"Mr.404"

More: http://redis.io/commands/hgethttp://www.redis.cn/commands/hget.html

HGETALL key

Get all the fields and values in a hash

127.0.0.1:6379>  HSET book.1 title helloworld
(integer) 1
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 1
127.0.0.1:6379> HGETALL book.1
1) "title"
2) "helloworld"
3) "author"
4) "Mr.404"

More: http://redis.io/commands/hgetallhttp://www.redis.cn/commands/hgetall.html

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 30
(integer) 1
127.0.0.1:6379> HINCRBY book.1 price 10
(integer) 40
127.0.0.1:6379> HINCRBY book.1 price -5
(integer) 35

More: http://redis.io/commands/hincrbyhttp://www.redis.cn/commands/hincrby.html

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 30
(integer) 0
127.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"

More: http://redis.io/commands/hincrbyfloathttp://www.redis.cn/commands/hincrbyfloat.html

HKEYS key

Get all the fields in a hash

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 0
127.0.0.1:6379> HKEYS book.1
1) "title"
2) "author"

More: http://redis.io/commands/hkeyshttp://www.redis.cn/commands/hkeys.html

HLEN key

Get the number of fields in a hash

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 0
127.0.0.1:6379> HLEN book.1
(integer) 2

More: http://redis.io/commands/hlenhttp://www.redis.cn/commands/hlen.html

HMGET key field [field ...]

Get the values of all the given hash fields

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 0
127.0.0.1:6379> HMGET book.1 author title
1) "Mr.404"
2) "helloworld

More: http://redis.io/commands/hmgethttp://www.redis.cn/commands/hmget.html

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.404
OK
127.0.0.1:6379> HGET book.1 title
"helloworld"
127.0.0.1:6379> HGET book.1 author
"Mr.404"

More: http://redis.io/commands/hmsethttp://www.redis.cn/commands/hmset.html

HSET key field value

Set the string value of a hash field

127.0.0.1:6379> HSET book.1 title helloworld
(integer) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 1
127.0.0.1:6379> HGET book.1 title
"helloworld"
127.0.0.1:6379> HGET book.1 author
"Mr.404"

More: http://redis.io/commands/hsethttp://www.redis.cn/commands/hset.html

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) 1
127.0.0.1:6379> HSETNX book.1 title hellopython
(integer) 0
127.0.0.1:6379> HGET book.1 title
"helloworld"

More: http://redis.io/commands/hsetnxhttp://www.redis.cn/commands/hsetnx.html

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) 0
127.0.0.1:6379> HSET book.1 author Mr.404
(integer) 1
127.0.0.1:6379> HVALS book.1
1) "helloworld"
2) "Mr.404"

More: http://redis.io/commands/hvalshttp://www.redis.cn/commands/hvals.html

HSCAN key cursor [MATCH pattern] [COUNT count]

Incrementally iterate hash fields and associated values

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

Redis 命令 - Hashs的更多相关文章

  1. redis命令大全

    redis windows下使用及redis命令 Redis 是一个开源,高级的键值对的存储.它经常作为服务端的数据结构,它的键的数据类型能够是strings, hashs, lists, sets( ...

  2. Redis命令拾遗二(散列类型)

    本文版权归博客园和作者吴双共同所有,欢迎转载,转载和爬虫请注明原文地址 :博客园蜗牛NoSql系列地址  http://www.cnblogs.com/tdws/tag/NoSql/ Redis命令拾 ...

  3. redis命令总结

     Redis命令总结 redis 127.0.0.1:6379> info  #查看server版本内存使用连接等信息 redis 127.0.0.1:6379> client list  ...

  4. redis如何执行redis命令

    Redis 命令 Redis 命令用于在 redis 服务上执行操作.所以我们必须要启动Redis服务程序,也就是redis安装目录下的redis-server.exe,你可以双击执行,也可以打开cm ...

  5. 常用 redis 命令(for php)

    Redis 主要能存储 5 种数据结构,分别是 strings,hashes,lists,sets 以及 sorted sets. 新建一个 redis 数据库 $redis = new Redis( ...

  6. Redis命令大全&中文解释&在线测试命令工具&在线中文文档

    在线测试命令地址:http://try.redis.io/ 官方文档:http://redis.io/commands http://redis.io/documentation Redis 命令参考 ...

  7. Redis命令

    redis的常用命令主要分为两个方面.一个是键值相关命令.一个是服务器相关命令(redis-cli进入终端) 1.键值相关命令 keys * 取出当前所有的key exists name 查看n是否有 ...

  8. redis命令参考

    http://doc.redisfans.com/ 进入redis命令行模式方式: 1.进入redis安装目录 2.运行redis-cli

  9. Redis 命令参考

    Redis 命令参考 http://redis.readthedocs.org/en/latest/index.html

随机推荐

  1. UVA10361 - Automatic Poetry

    “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb Raider XIV, Lara is, ...

  2. hbase 学习笔记一---基本概念

          说在前面,本文部分内容来源于社区官网经过适度翻译,部分根据经验总结,部分是抄袭网络博文,(不一一列举引用,在此致歉)一并列在一起,本文的目的,希望能总结出一些有用的,应该注意到的东西,基本 ...

  3. js即时监听文本内容

    <script type="text/javascript"> //其他浏览器 function OnInput (event) { alert ("文本内容 ...

  4. 【Java】IO技术的使用——用IO实现大文件的复制

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/5827481.html 用IO进行文件复制,实质就是用FileInputStream链接要复制的文件,按一定规模 ...

  5. Java中重写与重载的辨析

    摘要:在我们学习Java过程中,重写与重载使我们在面向对象里要学习的重要知识点之一,那我们看看它们有那些区别: 一.重写 1.概念:简单的说就是子类将从父类继承而来的方法重新实现一次. 2.特点: ① ...

  6. ADO.NET 快速入门(十四):使用 SQL Server 检索数据

    SqlDataReader 类提供了一种从数据源读取数据记录只进流的方法.如果想使用 OLE DB 接口的数据库或者 SQL Server7.0 之前的版本,请参考文章:使用 OLE DB 检索数据. ...

  7. Windows服务监视,如果停止则启动

    1.已新建好Windows服务监视器: 2.新建恢复: 注:恢复目标需要为监视器目标的子集 3.使用命令行方式: 运行PS脚本(脚本位于目标计算机本地): 运行VBS脚本: 4.设置完成

  8. Codeforces Round #330 (Div. 2) A. Vitaly and Night 暴力

    A. Vitaly and Night Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/595/p ...

  9. Codeforces Round #329 (Div. 2) B. Anton and Lines 逆序对

    B. Anton and Lines Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/pr ...

  10. Codeforces Gym 100523E E - Gophers SET

    E - GophersTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.a ...