1, and installation of related presentations redis redis, please see [ rookie tutorial ].
2, preparation, know a few shell commands.
3, repeat官网【Redis】.
4, into the theme: redis command.
5, Description: I am here for easy to use and is installed under Windows redis learn its basics. General use, then still need to put Linux in learning.
6, the overall experience of learning redis: Simple
Redis basic data types are five categories: String type, list types, set type, zset type, hash type. Therefore, according to this exemplary command explain five categories of data types:
First, the operation command string type :
1. Insert string types of data structures
set keyname1 keyValue - Key insertion type string Redis
2. Get string types of data structures
GET KeyName1
3. Delete Key
del KeyName1
Other common commands are as follows:
1, to get the string key string value (Note: This is only the substring key interception return in the show, the real key is the same value or if you need to change the key of value, you can use the following command getset)
GetRange Key Start End
Demo:
2. The old values of existing key to re-set, and returns the key of
getset key value
Example:
3 . Get plurality Key mget key1 [key2 ,,,,,,]
Example:
4 . Redis increment key incr key
Example: Each input the same command incr increamentKey, the value of this key is incremented by one.
Further, incr specified increment step size, incrby key increment
Specifies that increased step when execution of commands.
5 For key string already exists stitching again. append key value
Example:
More commands: See [ more redis string commands ]
Second, hash HASH
1 , insert a hash field structure HSET Key value 2 , to delete the one or more hash Field HDEL Key Field [ Field2 ] value
Example:
3 . Gets the hash table number of fields hlen hset1
4 . Gets all the values given field hmget Key field1 [ Field2 ... ]
5 while the plurality Field. - value (Domain - value) provided to the hash table key in. HMSET Key field1 VALUE1 [ Field2 value2 ]
6 . Only in the field when the field is not present, provided the hash table field values hsetnx Key field value
Example:
7 iterative hash table key-value pairs HASCAN Key Cursor [ the MATCH pattern ] [ COUNTcount ]
Third, the list List
dfds