当前位置:网站首页>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
边栏推荐
- [UTCTF2020]file header
- Hands on deep learning (IV) -- convolutional neural network CNN
- 2022-07-06:以下go语言代码是否会panic?A:会;B:不会。 package main import “C“ func main() { var ch chan struct
- [performance pressure test] how to do a good job of performance pressure test?
- Few-Shot Learning && Meta Learning:小样本学习原理和Siamese网络结构(一)
- 微信小程序基本组件使用介绍
- vus.SSR在asynData函数中请求数据的注意事项
- Leetcode 90: subset II
- A bit of knowledge - about Apple Certified MFI
- php导出百万数据
猜你喜欢
随机推荐
Technology cloud report: from robot to Cobot, human-computer integration is creating an era
IO stream file
面试结束后,被面试官在朋友圈吐槽了......
Leetcode 90: subset II
Ansible
智联+影音,AITO问界M7想干翻的不止理想One
2022 simulated examination question bank and online simulated examination of tea master (primary) examination questions
Cnopendata American Golden Globe Award winning data
Linux server development, MySQL stored procedures, functions and triggers
通信设备商,到底有哪些岗位?
buuctf misc USB
有 Docker 谁还在自己本地安装 Mysql ?
C语言二叉树与建堆
Solution: could not find kf5 (missing: coreaddons dbusaddons doctools xmlgui)
Figure out the working principle of gpt3
paddlepaddle 29 无模型定义代码下动态修改网络结构(relu变prelu,conv2d变conv3d,2d语义分割模型改为3d语义分割模型)
Explore Cassandra's decentralized distributed architecture
pytest+allure+jenkins环境--填坑完毕
Pytorch parameter initialization
探索Cassandra的去中心化分布式架构