当前位置:网站首页>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
边栏推荐
- 【obs】win-capture需要winrt
- json 数据展平pd.json_normalize
- Technology cloud report: from robot to Cobot, human-computer integration is creating an era
- [mathematical notes] radian
- Qt学习26 布局管理综合实例
- Button wizard collection learning - mineral medicine collection and running map
- 为什么要了解现货黄金走势?
- Write CPU yourself -- Chapter 9 -- learning notes
- misc ez_usb
- [2022 ciscn] replay of preliminary web topics
猜你喜欢
Explore Cassandra's decentralized distributed architecture
[2022 actf] Web Topic recurrence
@component(““)
json 数据展平pd.json_normalize
padavan手动安装php
The configuration that needs to be modified when switching between high and low versions of MySQL 5-8 (take aicode as an example here)
mysql多列索引(组合索引)特点和使用场景
[2022 ciscn] replay of preliminary web topics
After the interview, the interviewer roast in the circle of friends
Common method signatures and meanings of Iterable, collection and list
随机推荐
Button wizard script learning - about tmall grabbing red envelopes
buuctf misc USB
图解GPT3的工作原理
[performance pressure test] how to do a good job of performance pressure test?
【斯坦福计网CS144项目】Lab3: TCPSender
[experience sharing] how to expand the cloud service icon for Visio
MySQL multi column index (composite index) features and usage scenarios
Weibo publishing cases
Zhilian + AV, AITO asked M7 to do more than ideal one
[Stanford Jiwang cs144 project] lab4: tcpconnection
PHP exports millions of data
Rust Versus Go(哪种是我的首选语言?)
海思芯片(hi3516dv300)uboot镜像生成过程详解
CentOS7下安装PostgreSQL11数据库
探索Cassandra的去中心化分布式架构
You Li takes you to talk about C language 6 (common keywords)
Leanote private cloud note building
3D reconstruction - stereo correction
[advanced digital IC Verification] command query method and common command interpretation of VCs tool
大视频文件的缓冲播放原理以及实现