Redis is a database of key-value pairs with 5 of the primary data types :
String type (string), hash type (hash), list type (lists), collection type (set), Ordered collection type (zset)
One: String type
The string type is the most basic type of redis, and it can store any form of string. The other four types are different forms of string types.
The most basic command: GET, SET Syntax: GET Key,set Key value value if there are spaces that need double quotation marks to differentiate
Integer increment: INCR syntax: INCR key default value is 0, so first execute command get 1, not integer hint error
Add the specified integer: Incrby syntax: Incrby key increment
Integer decrement: DECR syntax: DECR key default value is 0, so first execute command get-1, not integral type hint error
Decrease the specified integer: Decrby syntax: Decrby key increment
Add a specified floating point number: Incrbyfloat syntax: Incrbyfloat key increment is similar to the INCR command, except that you can increment a double-precision floating-point number
Append value to Tail: APPEND Syntax: APPEND key value The Redis client is not the output appended string, but the total length of the output string
Get string Length: STRLEN syntax: STRLEN key if the key does not exist return 0, note that if there is Chinese, a Chinese length is 3,redis is used UTF-8 encoded Chinese
Get multiple Key values: MGET syntax: MGET key [key ...] Example: MGET key1 Key2
Set multiple key values: MSET syntax: MSET key value [key value ...] Example: MSET key1 1 Key2 "Hello Redis"
Multiple Redis commands, recorded for forgetting
5 Primary data types and commands for Redis