当前位置:网站首页>Software testing redis database
Software testing redis database
2022-07-03 10:57:00 【Software testing Intelligence Agency】
1.redis database
1.1NoSQL brief introduction
NoSQL There are many explanations :(Not relational SQL) You mean for “ Non relationship SQL”.
NoSQL The database does not have a unified architecture , Two kinds of NoSQL The difference between databases is even far more than the difference between the two relational databases , so to speak , Various NoSQL Each product has its own advantages , The success of NoSQL It must be especially suitable for certain occasions or applications .
At present, there are many websites in China , Such as Taobao 、 JD.COM 、 Baidu and others are using NoSQL Products .
1.2redis brief introduction
redis It's a free and open source NoSQL product .
redis Use ANSI C Language writing , It's a key-value The storage system . It supports storage value There are many types , Include string、hash、list、set and zset(sorted set- Ordered set ).
redis Periodically, updated data is written to disk or changes are written to an appended log file .
redis Is a high-performance key-value NoSQL product , It provides Java、C/C++,C#、PHP、 Etc. development interface , Easy to use .
1.3redis Basic operation
(1) Start the server
redis-sever
(2) Start client ( Chinese is not supported )
redis-cli
(3) Start the client with the following command , Can display Chinese correctly
redis-cli --raw
(4) Run the test command
ping
Server reply PONG On behalf of success
1.4 Switch database
select Select database ,redis Have from 0 To 15,16 A database
select 3 choice 3 The database
select 0 choice 0 The database
The default choice is 0 The database
1.5redis Key value pair description
redis yes key-value Data structure of
Every data is a “ Key value pair ”
The type of key is string string
The types of values are divided into : character string string、 Hash hash、 list list、 unordered set set、 Ordered set zset
1.5.1 character string string
set user1 aaa: Add a key user1 The value is aaa
setex user2 3 bbb : Set key value pairs user2 by ’bbb’, The expiration date is 3 second
mset user2 ccc user4 ddd user5 eee: Add multiple key value pairs at the same time
append user haha: Additional haha
get user1: obtain user1 Value
mget user1 user2 user3: Get multiple values
del user1: Delete value
del user2 user3: Delete multiple values
keys user1: Lookup key user1 Whether there is
keys *: Find all keys
exists user1: Lookup key , If there is a return 1, Returns if none exists 0
type user1: see user1 The type of the corresponding value
expire user1 100; Set expiration time for existing keys 100 second
ttl user1: In seconds , Return is greater than the 0 Represents the effective time , return -1 For forever , return -2 Key does not exist
1.5.2 Hash hash
1. A collection used to store key value pairs
2. The key in each hash can be understood as a field (field), A field (field) Corresponds to a value value
3.hash The median value Type is string string
4. Field names in the same hash field Not to be repeated
hset huser1 name tom:hset key Field value
hmset huser2 name maru sex female: Add one huser2 Value has 2 individual
type huser1: see huser1 The type of
hkeys huser1: obtain huse1 All the fields of
hget huser1 name: obtain huser1 Of name The value corresponding to the field
hmget huser name sex: obtain huser1 Of name、sex The value corresponding to the field
hvals huser1: Get the values of all fields
hgetall huser1 : Get all field names, including values
hdel huser1 sex: Delete huser1 Of sex The value corresponding to the field
del huser1: Delete huser1 All fields of
1.5.3list
lpush luser1 aa: Add... From the left side of the list luser1 The value is aa
rpush luser1 bb: Add... From the right side of the list bb
linsert luser1 before aa 11: stay aa Insert in front 11
linsert luser1 after aa 22: stay aa Insert... At the back 11
The index starts on the left , The index of the first value is 0, The index can be negative , It means counting from the tail ,-1 Represents the last value
lrange key 0 -1: Returns a list of 0 To the last value
lset user1 1 china : modify user1 The value of the second element of is China
Delete the duplicate values of the list ,count>0 Delete from beginning to end ,count<0 Delete... From tail to head ,count=0 Delete all values ,lrem luse1 -1 h1 Delete one from right to left h1,lrem luse1 0 h1 Delete all h1,lrem luse1 1 h1 Delete from left to right 1 individual h1
1.5.4set aggregate
Duplicate values are not allowed in the set , The values in the set can only be added and deleted , Do not modify
sadd suser2 aa bb cc: Add value to collection
smembers suser2 Display the values in the set
srem suser2 bb: Delete... From the collection bb
1.5.5zset Ordered set
Each value is associated with a score , Scores can be negative , Sort the values in the set by the size of the fractional value , Duplicate values are not allowed in the set , The values in the set can only be added and deleted , Do not modify
zadd zuser1 1 aa 5 bb 3 cc 8 dd: The added value will press scrore The size order of
zrange zuser1 0 -1: Return the values from the beginning to the end of the list
zrange zuser1 0 -1 withscores: Scores and values are displayed
zrangebyscore zuse1 2 6 return score stay 2-6 Between the value of the
zscore zuser1 dd : The return value is dd Of score
zrem zuser1 dd : Delete
zremrangebyscore zuser1 0 10: adopt score Delete value
Last : It can be in the official account : Sad spicy bar ! Get one by yourself 216 Page software testing engineer interview guide document information 【 Free of charge 】. And the corresponding video learning tutorial is free to share !, It includes basic knowledge 、Linux necessary 、Shell、 The principles of the Internet 、Mysql database 、 Special topic of bag capturing tools 、 Interface testing tool 、 Test advanced -Python Programming 、Web automated testing 、APP automated testing 、 Interface automation testing 、 Testing advanced continuous integration 、 Test architecture development test framework 、 Performance testing 、 Safety test, etc. .
I recommend one 【Python Automated test communication group :746506216】, We can discuss communication software testing together , Learn software testing together 、 Interview and other aspects of software testing , Help you advance quickly Python automated testing / Test Development , On the road to high pay .
Friends who like software testing , If my blog helps you 、 If you like my blog content , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One Key triple connection !
边栏推荐
- ByteDance layoffs, test engineers were almost destroyed: how terrible is the routine behind the recruitment of large factories?
- Differences among norm, normalize and normalized in eigen
- MAUI Developer Day in GCR
- 如何在游戏中制作一个血条
- QT:QSS自定义 QSlider实例
- Redis notes 01: Introduction
- 值得关注的15种软件测试趋势
- Promoted, colleagues become subordinates and don't cooperate with work
- MAUI Developer Day in GCR
- 测试Leader应该做哪些事
猜你喜欢
Snownlp emotion analysis
Bid -- service commitment -- self summary
有些能力,是工作中学不来的,看看这篇超过90%同行
[combinatorial mathematics] pigeon nest principle (simple form examples of pigeon nest Principle 4 and 5)
Bidding website architecture project progress -- Network Security
QT:QSS自定义 QTabWidget 和 QTabBar实例
Use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
17K薪资要什么水平?来看看95后测试工程师的面试全过程…
Large scale e-commerce project - environment construction
After 8 years of industry thinking, the test director has a deeper understanding of test thinking
随机推荐
STM32F1与STM32CubeIDE编程实例-TM1637驱动4位7段数码管
Chiyou (), a specific mythical image, is also gradually abstracted as a dramatic character type "Jing". "Jing", born in Dan Dynasty and ugly at the end, is the earliest "profession" in Chinese drama
QT:QSS自定义 QProgressBar实例
游戏测试相关 测试一个英雄的技能(春招被问比较多的一道题)
Qt:qss custom qmenubar instance
How to make a blood bar in the game
Unity group engineering practice project "the strongest takeaway" planning case & error correction document
使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》
C语言项目:学生成绩系统
项目组织战略管理
缓存路由组件
QT:QSS自定义QListView实例
Jupiter notebook changing font style and font size
QT: QSS custom qsplitter instance
Pytoch has been installed, but vs code still displays no module named 'torch‘
Extern keyword
QT: QSS custom qtableview instance
Qt:qss custom qstatusbar instance
QT:QSS自定义QToolButton实例
logstash备份跟踪上报的数据记录