Redis 命令参考(官方中文翻译)
下面列表是本人通过程序搜集的help命令整理的聚合列表,希望为redis填把火。
COMMAND | summary | since | group |
DEL key [key ...] | Delete a key | 1.0.0 | generic |
EXISTS key [key ...] | Determine if a key exists | 1.0.0 | generic |
EXPIRE key seconds | Set a key's time to live in seconds | 1.0.0 | generic |
KEYS pattern | Find all keys matching the given pattern | 1.0.0 | generic |
PEXPIRE key milliseconds | Set a key's time to live in milliseconds | 2.6.0 | generic |
RENAME key newkey | Rename a key | 1.0.0 | generic |
RENAMENX key newkey | Rename a key, only if the new key does not exist | 1.0.0 | generic |
SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE tination] | Sort the elements in a list, set or sorted set | 1.0.0 | generic |
TTL key | Get the time to live for a key | 1.0.0 | generic |
TYPE key | Determine the type stored at key | 1.0.0 | generic |
HDEL key field [field ...] | Delete one or more hash fields | 2.0.0 | hash |
HEXISTS key field | Determine if a hash field exists | 2.0.0 | hash |
HGET key field | Get the value of a hash field | 2.0.0 | hash |
HGETALL key | Get all the fields and values in a hash | 2.0.0 | hash |
HINCRBY key field increment | Increment the integer value of a hash field by the given number | 2.0.0 | hash |
HKEYS key | Get all the fields in a hash | 2.0.0 | hash |
HLEN key | Get the number of fields in a hash | 2.0.0 | hash |
HMGET key field [field ...] | Get the values of all the given hash fields | 2.0.0 | hash |
HMSET key field value [field value ...] | Set multiple hash fields to multiple values | 2.0.0 | hash |
HSET key field value | Set the string value of a hash field | 2.0.0 | hash |
HVALS key | Get all the values in a hash | 2.0.0 | hash |
LINDEX key index | Get an element from a list by its index | 1.0.0 | list |
LLEN key | Get the length of a list | 1.0.0 | list |
LPOP key | Remove and get the first element in a list | 1.0.0 | list |
LPUSH key value [value ...] | Prepend one or multiple values to a list | 1.0.0 | list |
LRANGE key start stop | Get a range of elements from a list | 1.0.0 | list |
LREM key count value | Remove elements from a list | 1.0.0 | list |
LSET key index value | Set the value of an element in a list by its index | 1.0.0 | list |
LTRIM key start stop | Trim a list to the specified range | 1.0.0 | list |
RPOP key | Remove and get the last element in a list | 1.0.0 | list |
RPOPLPUSH source destination | Remove the last element in a list, prepend it to another list and return it | 1.2.0 | list |
RPUSH key value [value ...] | Append one or multiple values to a list | 1.0.0 | list |
SADD key member [member ...] | Add one or more members to a set | 1.0.0 | set |
SCARD key | Get the number of members in a set | 1.0.0 | set |
SDIFF key [key ...] | Subtract multiple sets | 1.0.0 | set |
SDIFFSTORE destination key [key ...] | Subtract multiple sets and store the resulting set in a key | 1.0.0 | set |
SINTER key [key ...] | Intersect multiple sets | 1.0.0 | set |
SINTERSTORE destination key [key ...] | Intersect multiple sets and store the resulting set in a key | 1.0.0 | set |
SISMEMBER key member | Determine if a given value is a member of a set | 1.0.0 | set |
SMEMBERS key | Get all the members in a set | 1.0.0 | set |
SMOVE source destination member | Move a member from one set to another | 1.0.0 | set |
SPOP key [count] | Remove and return one or multiple random members from a set | 1.0.0 | set |
SRANDMEMBER key [count] | Get one or multiple random members from a set | 1.0.0 | set |
SREM key member [member ...] | Remove one or more members from a set | 1.0.0 | set |
SUNION key [key ...] | Add multiple sets | 1.0.0 | set |
SUNIONSTORE destination key [key ...] | Add multiple sets and store the resulting set in a key | 1.0.0 | set |
ZADD key [NX|XX] [CH] [INCR] score member [score member ...] | Add one or more members to a sorted set, or update its score if it already exists | 1.2.0 | sorted_set |
ZCARD key | Get the number of members in a sorted set | 1.2.0 | sorted_set |
ZCOUNT key min max | Count the members in a sorted set with scores within the given values | 2.0.0 | sorted_set |
ZINCRBY key increment member | Increment the score of a member in a sorted set | 1.2.0 | sorted_set |
ZRANGE key start stop [WITHSCORES] | Return a range of members in a sorted set, by index | 1.2.0 | sorted_set |
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count] | Return a range of members in a sorted set, by score | 1.0.5 | sorted_set |
ZRANK key member | Determine the index of a member in a sorted set | 2.0.0 | sorted_set |
ZREM key member [member ...] | Remove one or more members from a sorted set | 1.2.0 | sorted_set |
ZREMRANGEBYSCORE key min max | Remove all members in a sorted set within the given scores | 1.2.0 | sorted_set |
ZREVRANGE key start stop [WITHSCORES] | Return a range of members in a sorted set, by index, with scores ordered from high to low | 1.2.0 | sorted_set |
ZSCORE key member | Get the score associated with the given member in a sorted set | 1.2.0 | sorted_set |
DECR key | Decrement the integer value of a key by one | 1.0.0 | string |
DECRBY key decrement | Decrement the integer value of a key by the given number | 1.0.0 | string |
GET key | Get the value of a key | 1.0.0 | string |
GETSET key value | Set the string value of a key and return its old value | 1.0.0 | string |
INCR key | Increment the integer value of a key by one | 1.0.0 | string |
INCRBY key increment | Increment the integer value of a key by the given amount | 1.0.0 | string |
MGET key [key ...] | Get the values of all the given keys | 1.0.0 | string |
MSET key value [key value ...] | Set multiple keys to multiple values | 1.0.1 | string |
MSETNX key value [key value ...] | Set multiple keys to multiple values, only if none of the keys exist | 1.0.1 | string |
SET key value [EX seconds] [PX milliseconds] [NX|XX] | Set the string value of a key | 1.0.0 | string |
SETEX key seconds value | Set the value and expiration of a key | 2.0.0 | string |
SETNX key value | Set the value of a key, only if the key does not exist | 1.0.0 | string |
MULTI | Mark the start of a transaction block | 1.2.0 | transactions |
每个命令不复杂,难点就是命令太多,但还需要自己花时间一行行的敲,一个个的实验。
转载于:https://blog.51cto.com/dba10g/1843602