当前位置:网站首页>Redis basic type - hash
Redis basic type - hash
2022-07-24 06:48:00 【Life goes on and battles go on】
Harbin Hash:kv Pattern unchanged . but v It's a key-value pair
#============================
# hset hget The command is used to assign values to fields in the hash table
# hmset hmget There will be more than one field-value Set to hash table , The existing fields in the hash table will be overwritten
# hgetall Used to return the data in the hash table All fields and values
# hdel Used to delete hash tables key One or more specified fields in
#============================
127.0.0.1:6379> hset myhash field1 wyt
(integer) 1
127.0.0.1:6379> hget myhash field1
"wyt"
127.0.0.1:6379> hmset myhash field1 lmp field2 hyd
OK
127.0.0.1:6379> hget myhash field1
"lmp"
127.0.0.1:6379> hget myhash field2
"hyd"
127.0.0.1:6379> hgetall myhash
1) "field1"
2) "lmp"
3) "field2"
4) "hyd"
127.0.0.1:6379> hdel myhash field1
(integer) 1
127.0.0.1:6379> hgetall myhash
1) "field2"
2) "hyd"
#============================
# hlen Get the number of fields in the hash table
#============================
127.0.0.1:6379> hlen myhash
(integer) 1
127.0.0.1:6379> hmset myhash field1 wyt field2 lmp
OK
127.0.0.1:6379> hlen myhash
(integer) 2
#============================
# hexists Check whether the specified field of the hash table exists
#============================
127.0.0.1:6379> hexists myhash field1
(integer) 1
127.0.0.1:6379> hexists myhash field3
(integer) 0
#============================
# hkeys Get hash table I All domains in (field)
# hvals Returns all fields of the hash table (field) Value
#============================
127.0.0.1:6379> hkeys myhash
1) "field2"
2) "field1"
127.0.0.1:6379> hvals myhash
1) "lmp"
2) "wyt"
#============================
# hincrby Adds the specified increment value to the field value in the hash table
#============================
127.0.0.1:6379> hset myhash field 5
(integer) 1
127.0.0.1:6379> hincrby myhash field 1
(integer) 6
127.0.0.1:6379> hincrby myhash field -1
(integer) 5
127.0.0.1:6379> hincrby myhash field -10
(integer) -5
#============================
# hsetnx Assign values to fields that do not exist in the hash table
#============================
127.0.0.1:6379> hsetnx myhash field wyt
(integer) 1 # Set up the success return 1
127.0.0.1:6379> hsetnx myhash field wyt
(integer) 0 # If the given field already exists return 0
127.0.0.1:6379> hget myhash field
"wyt"
summary :
边栏推荐
- 【LVGL(4)】对象的事件及事件冒泡
- 【LVGL布局】网格布局
- DHCP principle and configuration
- [lvgl (4)] event and event bubble of the object
- JS - numerical processing (rounding, rounding, random numbers, etc.)
- Special effects - when the mouse moves, there will be a custom expression trail
- 目录和文件管理
- 账号和权限管理
- 【LVGL(1)】LVGL的简单介绍
- PyQt5入门——学生管理系统
猜你喜欢
随机推荐
[lvgl (1)] a brief introduction to lvgl
【ESP8266点焊机】基于 ESP8266 for Arduino
Promise (try to implement a promise by yourself) more detailed comments and other interfaces are not completed yet. Let's continue next time.
Browser local storage
[lvgl] API functions for setting, changing and deleting styles of components
HashSet转数组
RAID configuration experiment
System safety and Application
【媒体控制器】开源项目学习笔记(基于Arduino Micro开发板)
Solution: exit status 1 and exit status 145 appear when the console uses NVM to control the node version
Write cookies, sessionstorage, localstorage and session at will
Special effects - click the mouse, and a random color of love will appear
Mac解决 Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)问题
类的加载器 和 双亲委派机制详解
ES10 subtotal flat and flatmap
Customize ZABBIX agent RPM package
【USB电压电流表】基于STM32F103C8T6 for Arduino
Neural network superparameter adjustment (based on ray package)
【LVGL(1)】LVGL的简单介绍
Detailed explanation of class loader and parental delegation mechanism









