redis hash学习笔记
2017-11-03 本文已影响0人
星空星晴
http://www.cnblogs.com/stephen-liu74/archive/2012/02/15/2352932.html
获取key列表
keys *
判断key的类型
type key

操作hash key
分别取出hash里面的keys和values,类似于字典的操作
获取hash type的feild value列表
hgetall h1

获取hash type的某个feild的值
hget h1 field
hmget h1 field1 【field2 】

获取hash type的feild列表
hkeys h1

获取hash type的values列表
hvals h1

设置hash type的feild/value
hset key feild value
同时设置hash type的多个feild/value
hmset key feild value feild value feild value
获取hash type的长度
hlen key

判断hash type的feild是否存在
hexists key feild

删除hash type的一个或者多个field
HDEL key field [field ...]

对hash type的某个field进行增量(整型)运算,field不存在,创建feild并置为初始化为增量值
hincrby key field N

对hash type的某个field进行增量(浮点类型)运算
HINCRBYFLOAT key field N