List Related: Lpop key: Delete and get a list header element Rpop key: Delete and get a list trailing element Blpop key [key ...] timeout: delete and get the list header an element, if not on the BLOCKBRP OP key [key ...] timeout: Deletes and obtains an element of the list tail, if not Blocklpush key value: Expands an element in the list header Rpush key value: Expands an element lpushx K at the end of the list EY value: If list exists, expand an element in the list header rpushx key value: If list exists, expand an element at the end of the list Lindex key index: Gets an element of list by index Llen key: Take The length of the list Lrange key start stop: Gets the element of list within the specified range Lrem key count value: Delete list elements LSet key index value: Sets the value of the element of the list index to index LT RIM key start stop: Crop list, keep a range of elements Rpoplpush source destination: Deletes an element at the end of the current list and extends it to the tail of another list Brpoplpush source Destination timeout: pops up a list element and inserts it into another list, and then returns if the previous list is empty Blocksort key [by pattern] [LIMIT offset count] [GET pattern [GET pattern ...] [ASC|DESC] [ALPHA] [STORE destination]: Sort list,set, SORTED Setset Related: Sadd Key member: Add a member to set Srem Key member: Remove a member from set Sdiff key [key ...] : Set differential set Sinter key [key ...]: set for intersection sunion key [key ...]: Set sdiffstore destination key [key ...]: Set differential set and save result set to another set sinter Store destination key [key ...]: Sets the intersection and saves the result set to another collection Sunionstore destination key [key ...]: Sets the set and saves the result set to another collection SCard key: Get Total set Members Sismember Key member: Determines whether the given value is a set member Spop key: Delete and return the set any member Srandmember key: Returns the set of any member Smembers key: Gets all members of set Smove Source Destination member: Move one member of a set to another set Zset Related: Zadd key score member: Add a member to Sset, or update an existing member's Scorezcard key: Get Total members of Sset zcount Key min Max: Calculates the total number of members score within a given range in Sset Zincrby key: auto-increment sset scorezinterstore in Destination key [ Key ...] [WEIGHTS weight [weight ...] [AGGREGATE SUM| min|MAX]: Sset intersection and save the result set to a new Keyzrange key start stop [Withscores]: Returns a member of the Sset within a certain index range zrangebyscore key min MAX [withs Cores] [LIMIT offset count]: Returns a member of the Sset within a certain score range Zrem key member: Delete Sset in a member Zremrangebyrank key start stop: Remove Sset certain IND Ex Range member Zremrangebyscore key min Max: Delete Sset must score member within Range Zrevrange key start stop [Withscores]: Returns a member within a certain index range in Sset, The order is score from high to low Zrevrangebyscore key Max min [withscores] [LIMIT offset count]: Returns members within a certain score range in Sset, in order score from high to low zscore Key member: Get Scorezunionstore destination Numkeys key associated with a given member in Sset [key ...] [WEIGHTS weight [weight ...] [AGGREGATE SUM| min|MAX]: Sset set and save the result set to a new key hash Related: Hdel key field: Delete a hashfieldhexists key field: Determine if a Hashfield exists hget key field : Get a Hashfield value Hgetall key: Get a hash of all fields and Valueshincrby key field increment: Add Hashfield integer value to increment integer value Hkeys Key: Get hash all Fieldhlen key: Get hash within field total hmget key field [Field ...]: Get hash specify all values for field hmset key field value [Field Val UE ...] : Set hash of some filed and Valuehset key field value: Set a hash of a field for a Value hsetnx key field value: When a hash field does not exist, set it to a value hvals key: Get Hash of all values key Related: DEL key [key ...]: Delete a keyget key: Get the value of a key Setex key seconds value: Set Key's value and exp time setnx key value: Set key Value, provided that key does not exist before the set key value: Set Key,valueappend key value: Extend a value to a key debug OBJECT key: Get the debug information for a key DECR key: Give a KEY-1Decrby key integer: Give a key-Integerexists key: Determine if a key exists expire key seconds: Set a Key's TTL (second) expireat key timestamp: Set the TTL of a key (Unix Timestamp) TTL key: Get key Ttlpersist key: Remove expiration flag for a key keys pattern: Find all pattern-compliant Keymove key DB: Move one key to another database rename key newkey: Rename a Keyrenamenx key newkey: Rename a key if the new keyname does not exist Randomkey: Returning a any from keyspace keyvalue Related: GETRANGE key start end: Gets the substring of the specified range in the string corresponding to the key Getset key value: Sets the value corresponding to key and returns the old VALUEINCR Key: integer value corresponding to key increment 1INCRBY key: integer value corresponding to key auto-increment incrementmget key [key ...]: Get the value of all specified key Mset key value [key value ...] : Valuesmsetnx key specified for the specified keys value [key value ...]: When the specified key is present, the specified Valuesstrlen key is set for the specified keys: Gets the value of the key length of the server phase OFF: info: Get status information and statistics for the server monitor: real-time monitoring of all requests received by Server ping:ping Server quit: Close link publish channel message: Publish a message to a Channelauth Password: Authentication server lastsave: Gets the timestamp of the last successful Savetodisk object subcommand [arguments [arguments]]: detects the internal psubscribe p of a Redis object Attern [pattern ...]: listens to all pattern-compliant messages published to the channel punsubscribe [pattern [pattern]..]] : Stops listening for all pattern messages posted to the channel config Resetstat: Resets the status information returned by the info command subscribe Channel [channel ...]: Listen for messages unsubscribe [Channel [channel]]: Stop listening for messages from the specified channel unwatch:forget about all watched Keys stops monitoring all monitored keywatch key [key ...]: monitors all given keys to determine multi and exec block execution database Related: Save synchronously: Saving DataSet to Hard disk Select index: Switch the current database Bgsave: Asynchronously saves the DataSet to the hard disk Dbsize: Returns the total number of keys for a database flushall: Deletes all keyflushdb on the database: Deletes all Keysh on the current database Utdown synchronously: After saving the dataset to the hard disk, turn off server configuration Related: Config get parameter: Get a configuration parameter value CONFIG SET parameter value: Set a configuration parameter to the given value other: Getbit Key offset: Returns the value of the key corresponding to the bit values in offset multi: Identifies the beginning of a business block SetRange key offset value: Overwrites the value string corresponding to the write key from the specified offset bgrewriteaof: asynchronous rewrite append-Only filedebug Segfault: Make the server Crashdiscard: Ignore all commands that begin with multi ECHO message:echo messageexec: Execute all commands that start with multi slaveof h OST port: Make this server A slave of another Redis host, or make this server a master server sync: Internal backup command Linsert key before|after Refvalue value: Inserts the Valuezrank key member before or after the refvalue of the list key: Returns the rank (subscript) of the specified element in the collection, The elements in the collection are Zrevrank key member sorted by score from small to large: ditto, but the elements in the collection are sorted by score from large to small type key: Returns the value type of the given key. Return none indicates that no key,string character type exists, list linked list type set unordered collection type
Redis API Usage Notes