HDEL key field [field ...]

Delete one or more hash fields

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HEXISTS book.1 title
  4. (integer) 1
  5. 127.0.0.1:6379> HDEL book.1 title
  6. (integer) 1
  7. 127.0.0.1:6379> HEXISTS book.1 title
  8. (integer) 0

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

HEXISTS key field

Determine if a hash field exists

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 1
  3. 127.0.0.1:6379> HEXISTS book.1 title
  4. (integer) 1
  5. 127.0.0.1:6379> HEXISTS book.1 title2
  6. (integer) 0
  7. 127.0.0.1:6379> HEXISTS book.2 title
  8. (integer) 0

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

HGET key field

Get the value of a hash field

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 1
  5. 127.0.0.1:6379> HGET book.1 title
  6. "helloworld"
  7. 127.0.0.1:6379> HGET book.1 author
  8. "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

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 1
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 1
  5. 127.0.0.1:6379> HGETALL book.1
  6. 1) "title"
  7. 2) "helloworld"
  8. 3) "author"
  9. 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

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

  1. 127.0.0.1:6379> HSET book.1 price 30
  2. (integer) 0
  3. 127.0.0.1:6379> HINCRBYFLOAT book.1 price 9.99
  4. "39.99"
  5. 127.0.0.1:6379> HINCRBYFLOAT book.1 price -4.5
  6. "35.49"

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

HKEYS key

Get all the fields in a hash

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

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

HLEN key

Get the number of fields in a hash

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 0
  5. 127.0.0.1:6379> HLEN book.1
  6. (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

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 0
  5. 127.0.0.1:6379> HMGET book.1 author title
  6. 1) "Mr.404"
  7. 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

  1. 127.0.0.1:6379> HMSET book.1 title helloworld author Mr.404
  2. OK
  3. 127.0.0.1:6379> HGET book.1 title
  4. "helloworld"
  5. 127.0.0.1:6379> HGET book.1 author
  6. "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

  1. 127.0.0.1:6379> HSET book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 1
  5. 127.0.0.1:6379> HGET book.1 title
  6. "helloworld"
  7. 127.0.0.1:6379> HGET book.1 author
  8. "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

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

  1. 127.0.0.1:6379> HSETNX book.1 title helloworld
  2. (integer) 0
  3. 127.0.0.1:6379> HSET book.1 author Mr.404
  4. (integer) 1
  5. 127.0.0.1:6379> HVALS book.1
  6. 1) "helloworld"
  7. 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. Java常用类(String、StringBuffer、Math、Arrays)

    1.String 操作对象时会重新分配堆内存,栈内存的引用会重新指向新的堆内存 2.StringBuffer(字符串缓存区) 操作的对象一直都是一个 3.Math Math.max(xx,xx); M ...

  2. kettle内存溢出

    ETL工具kettle,在老版设计后,使用新版时,居然发生了内存溢出的错误: 出现: java heap 或者 OutOfMemory等字样 这是kettle分配的内存不足. 在kettle的运行路径 ...

  3. C# 生成解决方案失败,点击项目重新生成报找不到命名空间

    1.点击生成解决方案失败,点击项目“重新生成”找不到“XXX”命名空间. 尝试点击"重新生成解决方案"多次,然后点击项目的"重新生成"即可解决.

  4. C#的枚举数(Enumerator)和可枚举类型(Enumerable)

    数组可以被foreach语句遍历数组中的元素,原因是数组可以按需提供一个叫做枚举数(enumerator)的对象.枚举数可以依次返回请求的数组的元素. 对于有枚举数的类型而言,必须有一个方法来获取它们 ...

  5. asp.net中使用swfupload上传大文件

    转载:http://www.cnblogs.com/niunan/archive/2012/01/12/2320705.html 花了一天多时间研究出来的,其实也就是网上下别人的代码然后再自己修修改改 ...

  6. PostgreSQL的 initdb 源代码分析之十二

    继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...

  7. 硝烟中的scrum学习笔记 - 怎样制定Sprint计划(Plan Meeting)

    1. 如何估算我们这个sprint能做多少个故事点 1) 本能反应 2) 生产率计算  估算生产率/实际生产率  看看团队的历史,看看他们在过去几个sprint里的生产率是多少  然后假定在下一个sp ...

  8. lightOJ 1030(期望)

    题意:有一个迷宫是1×n的格子,一个人每到一个格子就能够把这个格子内的金子所有拿走,刚開始站在第1个格子,然后開始掷骰子得到点数x,他就要从当前位置走到加x的位置.假设发现位置是大于n的就又一次掷骰子 ...

  9. delphi ExecWB

    TWebBrowser.ExecWB 关键点 procedure ExecWB(cmdID: OLECMDID; cmdexecopt: OLECMDEXECOPT); overload; 实现过程 ...

  10. CSS3/jQuery自己定义弹出窗体

    简单演示一下,精简了演示效果和css样式文件,更利于在项目中的实际应用 引入style.css   index.js <!DOCTYPE HTML PUBLIC "-//W3C//DT ...