当前位置:网站首页>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 !
边栏推荐
- Snownlp emotion analysis
- Unity group engineering practice project "the strongest takeaway" planning case & error correction document
- snownlp情感分析
- 文件上传下载测试点
- 正常一英寸25.4厘米,在影像领域是16厘米
- Numpy quick start (II) -- Introduction to array (creation of array + basic operation of array)
- Comment réaliser des tests automatisés pour les tests logiciels embarqués?
- 软件测试——Redis数据库
- Qt:qss custom qradiobutton instance
- QT:QSS自定义QHeaderView实例
猜你喜欢

A detailed explanation of vector derivative and matrix derivative

Some abilities can't be learned from work. Look at this article, more than 90% of peers

Classification (data consolidation and grouping aggregation)

测试理论概述

Bid -- service commitment -- self summary

Jupiter notebook changing font style and font size

Basic theoretical knowledge of software testing -- app testing

QT: QSS custom qtreeview instance

嵌入式软件测试怎么实现自动化测试?

Pytoch has been installed, but vs code still displays no module named 'torch‘
随机推荐
分组函数之rollup、cube函数、grouping sets函数
Logstash backup tracks the data records reported
Unity learning notes: personal learning project "crazy genius Edgar" error correction document
年中了,准备了少量的自动化面试题,欢迎来自测
“测试人”,有哪些厉害之处?
Que se passe - t - il ensuite pour ceux qui se sont concentrés sur les tests automatisés?
文件上传下载测试点
Qt:qss custom qradiobutton instance
QT:QSS自定义 QSplitter实例
Numpy quick start (III) -- array advanced operation
Snownlp emotion analysis
Comment réaliser des tests automatisés pour les tests logiciels embarqués?
Take you into the cloud native database industry, Amazon Aurora
公司里只有一个测试是什么体验?听听他们怎么说吧
QT:QSS自定义 QScrollBar实例
STM32F1与STM32CubeIDE编程实例-TM1637驱动4位7段数码管
最高月薪18K 拥有好的“心态和选择”, 成功就差“认真和坚持”~
软件测试(测试用例)编写之俗手、本手、妙手
你真的需要自动化测试吗?
How to monitor the incoming and outgoing traffic of the server host?