当前位置:网站首页>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
边栏推荐
- C语言队列
- Use and analysis of dot function in numpy
- 【斯坦福计网CS144项目】Lab3: TCPSender
- Button wizard script learning - about tmall grabbing red envelopes
- Jenkins remote build project timeout problem
- Live online system source code, using valueanimator to achieve view zoom in and out animation effect
- 2022茶艺师(初级)考试题模拟考试题库及在线模拟考试
- Pytorch parameter initialization
- 2022 welder (elementary) judgment questions and online simulation examination
- C语言航班订票系统
猜你喜欢

3D reconstruction - stereo correction

SQL优化的魅力!从 30248s 到 0.001s
![[UTCTF2020]file header](/img/e3/818e2d531a06ab90de189055f634ad.png)
[UTCTF2020]file header

Idea add class annotation template and method template

【经验分享】如何为visio扩展云服务图标

Qt学习28 主窗口中的工具栏

探索干货篇!Apifox 建设思路

Problem solving: unable to connect to redis

Detailed explanation of Kalman filter for motion state estimation

Leetcode 90: subset II
随机推荐
[webrtc] M98 screen and window acquisition
2022焊工(初级)判断题及在线模拟考试
Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
Ansible
[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替
Hands on deep learning (IV) -- convolutional neural network CNN
2022年茶艺师(中级)考试试题及模拟考试
pytest+allure+jenkins安装问题:pytest: error: unrecognized arguments: --alluredir
Detailed explanation of uboot image generation process of Hisilicon chip (hi3516dv300)
nacos
[Stanford Jiwang cs144 project] lab3: tcpsender
Operation suggestions for today's spot Silver
这5个摸鱼神器太火了!程序员:知道了快删!
Leetcode 90: subset II
Zhilian + AV, AITO asked M7 to do more than ideal one
[experience sharing] how to expand the cloud service icon for Visio
C语言队列
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
解决could not find or load the Qt platform plugin “xcb“in ““.
Problem solving: unable to connect to redis