当前位置:网站首页>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
边栏推荐
- Overrides vs overloads of methods
- Target detection algorithm based on deep learning interview essential (rcnn~yolov5)
- ORA-15063: ASM discovered an insufficient number of disks for diskgroup 恢複---惜分飛
- flink部署模式总结
- How to deal with too small picture downloaded from xuexin.com
- How SQL server generates change scripts
- MySQL day03 class notes
- [fault diagnosis] the picture cut code cannot be cut out, slide read_ Region does not run, but the program does not report an error
- Postman uses (reads) JSON files for batch testing
- [scientific research notes] focal loss
猜你喜欢

ORA-15063: ASM discovered an insufficient number of disks for diskgroup 恢複---惜分飛

Disturbed when programmers are programming? Daily anecdotes

Solutions to MySQL 8.0 public key retrieval is not allowed errors

LeetCode——二叉搜索树的第k大节点(借助中序遍历)

IDP depth | what kind of data analysis and mining tools do enterprises need?

Remote Dictionary Server(Redis)——基于 KV 结构的作为 Cache 使用的 NoSQL 数据库管理系统
![[scientific research notes] focal loss](/img/ca/4a30fd925b87ed2baa2523d8dbf59d.png)
[scientific research notes] focal loss

A domestic developer opened the "programmer's Guide to cooking" and became popular!

How much does it cost to buy a fixed-term life insurance with an insured amount of 500000 at the age of 42? Is there any product recommendation

NFT mall building digital collection mall building digital collection market digital collection development company
随机推荐
Slurm tutorial
网页设计与制作期末大作业报告——小众音乐网站
mysql day02课堂笔记
招贤纳士-第23期
使用matplotlib实现GUI交互效果
Flink deployment mode (I) - standalone and Application
[sdx12] use qcmap_ CLI startup WiFi operation instructions
[user guide] use of Tsinghua source
Go learning (II. Built in container)
laravel的服务容器,服务提供者,门面的理解
【故障诊断】切图代码切不出来,slide.read_region不运行,但程序不报错
中闽在线:以“积分”为纽带 共享线上渠道资源
What is cloud hosting and what are its advantages?
Golang concise architecture practice
numpy庫常用知識整理
MySQL day01 class notes
mysql笔记
Progress warning and problem management of progress control in Zhiyuan project management SPM system
【故障诊断】CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace b
[details] domestic website filing process and steps