1. Redis supports five types of data type strings (string), hash (hash), List (list), set (set), Zset (ordered set);
2. String is the most basic type of redis, a key can support storage 512MB;
Set name "Lanyulei"
Del name
Set a key that is name, and the corresponding value is a string of Lan Yulei
Get Name
Result set is "Lanyulei"
3. Redis Hash is a String type field and value mapping table, hash is especially suitable for storing objects
Hmset user username Lanyulei sex Mans age 25
Set a hash value, key is User,value is the form of an even number
Each hash can store 2 of the 32-1-square, key-value pairs (more than 4 billion)
4. Redis is a simple list of strings, sorted by insertion order, and you can add the head or tail of an element guide list.
Set a list type data named Lanyulei, and the contents are added and displayed in order
Lpush Lanyulei Redis
Lpush Lanyulei MongoDB
Lpush Lanyulei RABITMQ
The value,0 10 for this list "Lanyulei" is the data that is obtained before the subscript is 0 to 10
Lrange Lanyulei 0 10
5. Unordered Collection Creation
Set an unordered collection
Sadd Lanyulei Redis
Sadd Lanyulei MongoDB
Sadd Lanyulei MySQL
Sadd Lanyulei MySQL
Get the contents of this collection
Smembers Lanyulei
6. Creation of ordered collections
An ordered collection is also a collection of elements of type string, as well as a collection, and does not allow duplicate members.
The members of an ordered collection are unique, but fractions (score) can be duplicated.
Zadd Lanyulei Redis
Zadd Lanyulei MongoDB
Zadd Lanyulei MySQL
Zadd Lanyulei MySQL
Get the contents of this collection
Zmembers Lanyulei
Data types and how to set up Redis