String type of operation
Hash type of operation
List the type of operation
set the type of operation
zset type of operation
Spoken instructions
String type of operation
The most common type, typical of the type kv
set key value
String type data set
get key
According to acquire key value
getset key value
If no value and the setting value is set a key, if it takes a value, and assigning a new value.
incr key
Increment value, but the value is not a number. If the key does not exist a default value
incrby key increment
Increments specified number of steps
decr key
Decreasing value
decrby key increment
Decreasing the number of steps
setnx key value
If the key does not exist, it will be added, or not added
append key value
If there is no additional key added value is created based on key
strlen key
The length of the key value acquired
mset key value key value ...
Set multiple key and value
mget key key key ...
Get more key
Hash type of operation
type of hash used to store the object type, such as a person object exist, if an object needs frequent modify certain attributes, the type can be stored hash. Of course, also be present string, but the need to string into json, and each time required to modify the properties of all out value.
hset key field value
And a single field setting key
hget key field
Gets the field of key
hmset key field value field value...
While a plurality of key fields
hmget key field field...
Simultaneously acquire the plurality of field values
hgetall key
Get all of the key attributes and values
hdel key field field...
Delete one or more fields
hsetnx key field value
Only if the field does not exist only to set the field, but only set up a field
hincrby key field increment
Set auto-increment field, but only a number, and can only set up a field
hexists key field
Gets field is present
hkeys key
Get all of the key fields
whales key
Get all of the key field values
choose key
Gets the number of key fields
List the type of operation
type key list corresponding to a plurality of value they are in order (the order of addition) and the type of list elements can duplicate values.
lpush key value value value ...
But add an element added from the left, note, not added from the left
lrange key start stop
Get the list of elements, starting at the specified position, the end position specified, start index from 0 to -1 indicates stop until the last.
rpush key value value
Add elements from the right side of the set.
lpop key
Removing an element from the left, and the return element is removed
rpop key
Removes an element from the right, and returns the element is removed
Llen key
Gets the number of elements in the list.
lrem key count value
Deletes the specified value specified number, for example three in list A (lrem list 2 value) will remove two A
lindex key index
Gets the specified index element
lset key index value
Modify the specified target value
ltrim key start end
Leaving only the start to the end delete other elements
linsert key before|after pivot value
Looking for a specified value and this value is added before or after the specified value
rpoplpush list1 list2
The elements of list1 in rpop lpush to list2 in.
set the type of operation
repeating unordered type element is not set (the order of addition)
sadd key value value ...
Adds the specified element
smembers key
Get all the elements
srem key value
Delete the specified element
sismember key value
Determine whether there is an element
card key
Gets the number of elements
spop key
A random pop elements, note that pop is back and delete.
sdiff key1 key2 ...
Taking the difference set, there is no A in B, in the
sinter key1 key2 ...
Taking an intersection with the A in B, also
sunion key1 key2
And set, taking all the elements in AB, but not repeated
zset type of operation
Set on the basis of an increase of a fraction
zadd key score value score value...
Adding elements
zrange key start stop
Get elements between start stop (comprising start stop) and sorted in ascending scores
zrevrange key start stop
Get elements between start stop (comprising start stop) and sorted in descending score
zrank key value
Gets the element of rank from small to large
zrevrank key value
Gets the element of rank descending
zscore key value
Fractional value of the acquired
zrem key value value...
Removes the specified element is not removed if the value does not exist
zremrangebyrank key start end
Delete the specified range of elements in the score ranking
zremrangebyscore key staet end
Delete the specified element range of scores
zrangebyscore key min max
Gets the value of the specified interval score
zcount key min max
Get the number of elements within the range specified fraction
zincrby key score value
Increase the score value of
zcard key
Gets the number of elements
Spoken instructions
keys pattern
Match to get the key
del key key ...
Delete the specified key
exists key
Determine whether there is key
rename keyName keyName
Rename the key
type key
Get key type
expire key seconds
key expiration time set, the default seconds
To set up a key, and then set the expiration time
ttl key
The expiration time of the query key
persist key
Clear expiration time, key not expire
pexpire key milliseconds
Set the expiration time in milliseconds