当前位置:网站首页>Linux server development, detailed explanation of redis related commands and their principles
Linux server development, detailed explanation of redis related commands and their principles
2022-07-07 07:55:00 【Tuen Mun pheasant calls me chicken】
Recommend a free open course of zero sound College , Personally, I think the teacher spoke well , Share with you :Linux,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK, Streaming media ,CDN,P2P,K8S,Docker,TCP/IP, coroutines ,DPDK Etc , Learn now
MySql use B+ Tree organization data structure , and redis use dictionary Way to organize data structures .
command
- lpush liststr Mark Darren King King
- lrange liststr 0 -1 // It means from the first to the last
- set sayid 1000
- incr sayid
- incrby key 100
- decrby key 100
- setnx feng - // No, set successfully
- object encoding Mark
- setbit xxxx 9 1
application
- Record the number of likes of friends , Comments and hits .(hash)
- Record the circle of friends and talk about the list ( Sort ), Easy to display on the list page .(hash)
- Record the title of the article , Abstract , Sitting and cover , For list page display .(hash)
- Record the likes of users in the circle of friends ID list , Comment on ID list , For display and weight removal technology .(zset)
- Caching hot data , Reduce database pressure .(hash)
- If the circle of friends say ID Is an integer ID, have access to redis Let's allocate a circle of friends and talk about ID( Counter ).(string)
- Through set (set) Call and search set operation to record friends .(set)

string
set role:10001 ‘{[name]=“mark”,[age]=‘18’,[sex]=male}’
// Little change
//role:10001:recharge:10001
Distributed lock
- redis The implementation is an unfair lock , Block waiting
- setnx lock 1
- set lock uuid nx ex 30
- del lock
An operation
- setbit sign:10001:202106 1 1
- bitcount sign:10001:202106
- getbit sign:10001:202106 2
list
- LPUSH key value value value
- LPOP key
- LRANGE key start end
- LREM key count value
- BRPOP key timeout // Key features , The empty one is blocked here 0 For permanent blocking
- LTRIM say 0 49 // Get the leftmost 50 individual
- LRANGE say 0 49
hash
- HINCRBY key field increment
- HLEN key
set
- Disordered storage , Intersection and difference need to be sorted
- SADD key value1 value2 value3
- SMENBERS key
- SINSMENBER key value1
- SRANDMEMBER key 2 // Random access 2 individual
- SPOP key 1 // Kick one randomly
- SIDFF key
- SINTER key
- SUNION key
zset
- ZADD rank 100 MARK
- ZINCRBY rank 20 MARK
- ZCARD rank
- ZRANGE rank 80 100 byscore
- ZRANGE rank 80 100 byscore withscore
- ZREVRANGE rank 80 100 byscore withscore
Typical applications : Ranking List
边栏推荐
- [unity] several ideas about circular motion of objects
- Ansible
- Cnopendata geographical distribution data of religious places in China
- Codeforces Global Round 19
- buuctf misc USB
- Regular e-commerce problems part1
- Pytest + allure + Jenkins Environment - - achèvement du remplissage de la fosse
- Qt学习28 主窗口中的工具栏
- 2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
- @component(““)
猜你喜欢

LeetCode 40:组合总和 II

Common method signatures and meanings of Iterable, collection and list

探索干货篇!Apifox 建设思路

Idea add class annotation template and method template

Kbu1510-asemi power supply special 15A rectifier bridge kbu1510

Iterable、Collection、List 的常见方法签名以及含义

Visualization Document Feb 12 16:42

Detailed explanation of Kalman filter for motion state estimation

有 Docker 谁还在自己本地安装 Mysql ?

Operation suggestions for today's spot Silver
随机推荐
Pytest + allure + Jenkins Environment - - achèvement du remplissage de la fosse
SQL优化的魅力!从 30248s 到 0.001s
[performance pressure test] how to do a good job of performance pressure test?
[UTCTF2020]file header
有 Docker 谁还在自己本地安装 Mysql ?
Solution: could not find kf5 (missing: coreaddons dbusaddons doctools xmlgui)
3D reconstruction - stereo correction
C语言航班订票系统
【obs】win-capture需要winrt
Common validation comments
Leetcode 40: combined sum II
IO stream file
Qt学习27 应用程序中的主窗口
Figure out the working principle of gpt3
[VHDL parallel statement execution]
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
gslx680触摸屏驱动源码码分析(gslX680.c)
C语言队列
Idea add class annotation template and method template
Solve could not find or load the QT platform plugin "xcb" in "