当前位置:网站首页>Hash type of redis
Hash type of redis
2022-06-22 05:00:00 【Engage in money self-discipline】
- hset Set up hash type
- hget obtain hash type
- hmset Batch settings hash type
- hmget Batch acquisition hash type
- hgetall Get all the data
- hdel Delete hash Appoint key Field , Corresponding value The value disappears
- hlen obtain hash The number of fields in the table
- hexists Judge hash Specifies whether the field exists
- hkeys Only get all field
- hvals Only get all value
- hincrby Specify incremental increase
- hsetnx If it does not exist, it can be set , If it exists, you cannot set
hash Suitable for storing changed data , Especially user information and so on , Constantly changing information !hash More suitable for object storage ,String More suitable for string storage .
127.0.0.1:6379> hset myhash field1 zhangsan #set A specific key-value
(integer) 1
127.0.0.1:6379> hget myhash field1 # Get a field value
"zhangsan"
127.0.0.1:6379> hmset myhash field1 hello field2 world #set Multiple key-value
OK
127.0.0.1:6379> hmget myhash field1 field2 # Get multiple field values
1) "hello"
2) "world"
127.0.0.1:6379> hgetall myhash # Get all the data
1) "field1"
2) "hello"
3) "field2"
4) "world"
127.0.0.1:6379> hdel myhash field1 # Delete hash Appoint key Field , Corresponding value The value disappears
(integer) 1
127.0.0.1:6379> hgetall myhash
1) "field2"
2) "world"
127.0.0.1:6379> hmset myhash field1 hello field2 world
OK
127.0.0.1:6379> hgetall myhash
1) "field2"
2) "world"
3) "field1"
4) "hello"
127.0.0.1:6379> hlen myhash # obtain hash The number of fields in the table
(integer) 2
127.0.0.1:6379> hexists myhash field1 # Judge hash Specifies whether the field exists
(integer) 1
127.0.0.1:6379> hexists myhash field3
(integer) 0
127.0.0.1:6379> hkeys myhash # Only get all field
1) "field2"
2) "field1"
127.0.0.1:6379> hvals myhash # Only get all value
1) "world"
2) "hello"
127.0.0.1:6379> hset myhash field3 5
(integer) 1
127.0.0.1:6379> hget myhash field3
"5"
127.0.0.1:6379> hincrby myhash field3 1 # Specify incremental increase
(integer) 6
127.0.0.1:6379> hincrby myhash field3 -1
(integer) 5
127.0.0.1:6379> hsetnx myhash field4 hello # If it does not exist, it can be set
(integer) 1
127.0.0.1:6379> hsetnx myhash field4 world # If it exists, you cannot set
(integer) 0
边栏推荐
- 《数据库原理》期末考试题
- 【使用指南】清华源的使用
- 重构思维系列2-函数及变量
- 【sdx62】QCMAP_CLI手动拨号操作说明
- Golang concise architecture practice
- exness:欧洲央行行长拉加德重申计划在7月会议上加息
- Slurm tutorial
- VirtualBox 6.1.34 release
- Gavin's perception of transformer live class - NLU and policies data decryption, source code analysis and practice of insurance BOT in the insurance industry of Rasa dialogue robot project (57)
- 10 "no no no" redis interview questions
猜你喜欢

The Impossible Triangle of NLP?
![[camp] at the beginning, improve [leopard] power - vivo activity plug-in management platform](/img/75/6a129de59c21b783622ba31f77f647.jpg)
[camp] at the beginning, improve [leopard] power - vivo activity plug-in management platform

下拉刷新,上推加载(简单好用,终于会了)
![Reading notes on how MySQL works [updating]](/img/4a/56cff3db0d45e66f51beb490c3ae71.jpg)
Reading notes on how MySQL works [updating]

NFT mall building digital collection mall building digital collection market digital collection development company

Circuit board layout and wiring precautions for analog / digital mixed signals

Daemon flow

【科研笔记】Focal Loss

Remote Dictionary Server(Redis)——基于 KV 结构的作为 Cache 使用的 NoSQL 数据库管理系统

软件架构与模式:结构、组件、关系
随机推荐
ORA-15063: ASM discovered an insufficient number of disks for diskgroup 恢复---惜分飞
加快推进工业互联网,图扑“智”绘发展新蓝图
MySQL common SQL
The feeling of leaving full-time for a single month!
当程序员编程时被打扰 | 每日趣闻
lua笔记
【sdx62】QCMAP_ CLI manual dialing instructions
Network Interview eight part essay of daily knowledge points (TCP, startling group phenomenon, collaborative process)
Great! Huaibei and Huaibei enterprises are approved to use special marks for geographical indication products
numpy庫常用知識整理
Learning signal integrity from scratch -- 7-si analysis and simulation
MySQL notes
Final examination questions of Database Principles
数据的备份与恢复
《数据库原理》期末考试题
这是一个图片
Qt保存QTextEdit内存至.txt文件中
cadence allegro 17. X conversion tool for downgrading to 16.6
【故障诊断】cv2.imwrite无法写入图片,但程序就是不报错
go学习(一、基础语法)