5 types of data are inseparable from key, first listing the key's related commands.
Key related Operations
String
-
Assignment value
-
Integer increment or decrement, only if value is numeric
INCR keyDECR key
If you want to increase the number specified
INCRBY key valueDECRBY key value
-
Floating-point number increase
INCRBYFLOAT key value
-
Trailing append
APPEND key value
-
Get length
STRLEN key
-
Bit-related operations
Specify access to the index:
SETBIT key index valueGETBIT key index
Get 1 of the quantity
BITCOUNT key indexFrom indexTo
Bitwise operations that support and OR not XOR operations, such as:
BITOP OR key3 key1 key2
Hash column
-
Assignment value
HSET key field valueHGET key fieldHMSET key field1 value1 field2 value2HMGET key filed1 field2HGETALL key
-
Determine if a field exists
HEXISTS key field
Does not exist then assign Value hsetnx key field value
-
Field increment
HINCRBY key field value
-
Delete a field
HDEL key field1 field2
-
View field Information
View field names
HKEYS key
View field values
HVALS key
Number of fields
HLEN key
List
-
Both ends increase
-
Both ends eject
LPOP keyRPOP key
-
Get the number of elements
LLEN key
-
Get by index
Gets the specified index value
LINDEX key index
Get fragments
LRANGE key indexFrom indexTo
-
Assigning values by index
LSET key index value
Or find the pivot element from left to right in the list and insert value in front or back as determined by before or after
LINSERT key BEFORE|AFTER pivot value
-
Delete specified value
Delete elements before count values are value
LREM key count value
Keep only elements in the index range
LTRIM key indexFrom indexTo
Collection
Ordered collection
- add element
-
ZADD key score1 value1 score2 value2
-
Delete Element
-
Delete the specified element
ZREM key value1 value2
-
Delete by index range
ZREMRANGEBYRANGE key indexFrom indexTo
-
Delete by score Range
ZREMRANGEBYSCORE key min max
-
Score increase
ZINCRBY key score value
-
Get points
ZSCORE key value
-
Get elements
-
Gets the elements within the specified range, in the score positive and reverse order, with the same fractions, in the UTF-8 encoding order of value, and score if the Withscore is added.
ZRANGE key indexFrom indexTo [WITHSCORES]ZREVRANGE key indexFrom indexTo [WITHSCORES]
-
Gets the elements within the specified fractional range, still sorted by fractions.
Takes score to the element between Min and Max, which by default includes elements equal to Min and Max.
If you do not plan to include, then add "(" in front of Min or Max.
The last limit usage is similar to SQL.
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
-
Get element rank
ZRANK key valueZREVRANK key value
-
Number of elements
Collection size
ZCARD key
Specifies the number of points in the range, as with Zrangebyscore, where Min and Max are included by default, including Min and Max.
ZCOUNT key min max
Redis-Data type common commands