REdis is stored in key-value pairs, so it's called a dictionary test. Redis (Remote dictionary server) long-range dictionary server
each Redis data type will have the ability to add, delete, view, and use instances to learn commands. Let's start with a single string operation, followed by a bulk string operation
================================== The following is the addition of a single character, starting ===============================
Instance operations:
1. Add a character type store the author is the Zhangnala operation, the key is author
command format: set key value
Solution: Set author Zhangnala
Note: Do not add semicolons to the end of key and value without commas
2. Judge author this key is not in
Command format:exists key
Solution: Exists author
Note: If the return is 1, is present, if return is 0, this key does not exist
3. Get the value of the author key
command format: get key
Solution: Get Author
Answer: Zhangnala
4. Give author this key corresponding to the value that is Zhangnala, append string (Kimi)
command format: append key "Append string"
Solution: Append Author "Kimi"
Answer: Zhangnalakimi
Note: Remember that the string needs to be appended with double quotation marks wrapped up, if the key value does not exist, then the execution is a set operation, such as Append eglishname Kimi, this eglishname key dry Ben does not exist, Then the Redis internal actually performs the operation of set eglishname Kimi;
5. Get the string length
For example, get the length of the value that corresponds to the author key
command format: strlen key
Solution: Strlen Author
Answer: 13
6. Remove the author button
command format:del key
Solution: Del author
=========================================== The following is a bulk Add/remove character, starting ===============================
1. Add a name named Xiao Li, height 1.60 of the data
command format: mset key1 value1 key2 value2
Solution: Mset name Xiaoli hight 1.60
Note: There is no need to add a comma between the key and value, the bulk of the key-value pairs, the comma is not used between the separation, the end of the time do not use the customary semicolon
2. Bulk get the value of the Name,hight key
command format: mget key
Solution: Mget name Hight
Answer: Xiaoli
1.60
3. Remove the
=========================================== Extended Operation ===============================
1. Get the data type of the key value (first: string "character type" second: hash "hash Type", Third: List "type", Fourth: Set "collection type", Fifth: Zset "ordered set type")
Command: Type key
such as: type name
Answer: String
2. View all key values
Keys *
3. Clear all the key values that exist in Redis, and then clear the library Delete db in a similar database.
Command: Flushall or FLUSHDB
Redis data Type (a) string