当前位置:网站首页>Redis: hash type data operation command
Redis: hash type data operation command
2022-07-04 04:28:00 【dengfengling999】
single key: object ( Property name - Property value ...)
Hash type (hash)
Redis Of hash It's a string Type of key and value Mapping table , there value It's a series of key-value pairs ,hash Ideal for storing objects .
The general idea of hash type data operation is through key and field operation value,key It's a data ID ,field Is domain ,value It's our feeling
Business data of interest .



1.hset
grammar :hset key field value [field value …]
function : Set the key value to field-value Set to Hash list key in , If key non-existent , Then create a new Hash list , The assignment is then performed , If key Under the field Already exist , be value Value override .
Return value : Returns the number of key value pairs successfully set .

for example :

2.hget
grammar :hget key field
function : Get hash table key Given domain in field Value .
Return value :field Domain value , If key Nonexistence or field There is no return nil.

for example :

3.hmset and hset Function as
grammar :hmset key field value [field value…]
function : There will be more than one field-value ( Domain - value ) Set to hash table key in , This command will overwrite the existing field,hash surface key non-existent , Create empty hash surface , Re execution hmset.
Return value : Set successfully returned ok, If it fails, an error is returned .

for example :


4.hmget
grammar :hmget key field [field…]
function : Get hash table key The value of one or more given fields in
Return value : Return and field The value corresponding to the order , If field non-existent , return nil.

for example :
Don't know hsah Medium file Time use :
5.hgetall
grammar :hgetall key
function : Get hash table key All fields and values in
Return value : Return... As a list hash The values of the middle field and the field ,key non-existent , Returns an empty hash.

for example :
6.hdel
grammar :hdel key field [field…]
function : Delete hash table key One or more specified domains in field, non-existent field Direct to ignore .
Return value : Successfully deleted field The number of .

for example :
7.hlen
grammar :hlen key
function : Get hash table key Mesosphere field The number of
Return value : The number ,field The number of .key There is no return 0.

for example :
8.hexists
grammar :hexists key field
function : Look at the hash table key in , Given domain field Whether there is
Return value : If field There is , return 1, Other return 0.

for example :stu1002 above name Has deleted

9.hkeys
grammar :hkeys key
function : Look at the hash table key All in field Domain list
Return value : Contains all the field A list of ,key There is no return empty list

for example :
10.hvals
grammar :hvals key
function : Return hash table List of values for all fields in
Return value : A list of all the field values in the hash table ,key There is no return empty list .
for example :
11.hincrby
grammar :hincrby key field int
function : To the hash table key Medium field Domain addition int
Return value : Returns the added field Domain value

for example :

12.hincrbyfloat
grammar :hincrbyfloat key field float
function : To the hash table key Medium field Domain addition float
Return value : Returns the added field Domain value

for example :
13.hsetnx
grammar :hsetnx key field value
function : Hash table key In the domain field Is set to value , If and only if domain field Set when it doesn't exist , Otherwise, do not set .
Return value : Set value returned successfully 1, Other return 0.

for example :
边栏推荐
- Pytest basic self-study series (I)
- Idea modify body color
- 一个漂亮的API文档生成工具
- R语言中如何查看已安装的R包
- 2021 RSC | Drug–target affinity prediction using graph neural network and contact maps
- 如何远程办公更有效率 | 社区征文
- 苹果CMS仿西瓜视频大气响应式视频模板源码
- Apple CMS imitation watermelon video atmospheric response video template source code
- [microservices openfeign] two degradation methods of feign | fallback | fallbackfactory
- 旭化成首次参展第五届中国国际进口博览会(5th CIIE)
猜你喜欢

精品网址导航主题整站源码 wordpress模板 自适应手机端

一个漂亮的API文档生成工具

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x98 in position 1093: illegal multibyte sequence

Emlog用户注册插件 价值80元

Leetcode skimming: binary tree 08 (maximum depth of n-ary tree)

Graduation project

Leetcode skimming: binary tree 04 (sequence traversal of binary tree)

Flink学习6:编程模型

Graduation project: design seckill e-commerce system

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
随机推荐
TCP-三次握手和四次挥手简单理解
Redis:有序集合zset类型数据操作命令
5张图告诉你:同样是职场人,差距怎么这么大?
Emlog user registration plug-in is worth 80 yuan
VIM mapping command
VIM add interval annotation correctly
ModStartBlog 现代化个人博客系统 v5.2.0 源码下载
Detailed explanation of event cycle
Restore the subtlety of window position
Touch and take you to implement an EventEmitter
Boutique website navigation theme whole station source code WordPress template adaptive mobile terminal
软件测试是干什么的 发现缺陷错误,提高软件的质量
[microservice openfeign] @feignclient detailed explanation
JS realizes the effect of text scrolling marquee
资深开发人员告诉你,怎样编写出优秀的代码?
如何远程办公更有效率 | 社区征文
【微服务|openfeign】feign的两种降级方式|Fallback|FallbackFactory
(指針)自己寫一個比較字符串大小的函數,功能與strcmp類似。
Three years of graduation, half a year of distance | community essay solicitation
新手找陪驾要注意什么