What are the methods of quickly generating test data by Redis
This article mainly explains "what are the methods for Redis to quickly generate test data". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the methods for Redis to generate test data quickly?"
Method 1 (lua script):
Vim redis_load.lua
For I = 1, 500000, 1 do
Redis.call ("SET", "ZzZMYKEY_ZzZ".. "key", I)
End
Return "Ok!"
Redis-cli-eval redis_load.lua
Method 2 (shell script):
Vim test.sh
For i in seq 1 1000000
Do
Echo key:$ {I} = > value:$ {I}
Redis-cli set key:$ {i} value:$ {i}
Done
Method 3 (debug populate):
127.0.0.1 6379 > debug populate 10000000
OK
(9.12s)
Note: the shell scripting method is the slowest, and the third method is the fastest.
Thank you for your reading, the above is the content of "what are the methods for Redis to quickly generate test data". After the study of this article, I believe you have a deeper understanding of what the method of rapid generation of test data by Redis has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!