First, Key
Key command Quick check:
Command |
Description |
Del |
Delete the given one or more keys, the nonexistent key will be ignored, the return value: the number of deleted keys |
DUMP |
Serializes the given key, returns the serialized value, and uses the RESTORE command to deserialize the value into the Redis key |
EXISTS |
Checks if a given key exists |
EXPIRE |
Set a valid time for a given key, accept a point in time |
Expireat |
Set the effective time for the given key, and accept the timestamp timestamp |
KEYS |
Find all keys that match the pattern of the given patterns ;KEYS * matches all Key;keys H?llo matching Hello,hallo in the database. KEYS H[ae]llo matches Hello and Hallo |
MIGRATE |
The key is atomically transferred from the current instance to the specified database of the target instance, and once the transfer succeeds, the key is guaranteed to appear on the target instance, and the key on the current instance is deleted. Two instances of migration are blocked during execution |
MOVE |
Moves the key of the current database to the given DB |
OBJECT |
View the Redis object for a given key from the inside |
PERSIST |
Remove the valid time for a given key |
Pexpire |
Set the effective time of key in milliseconds |
Pexpireat |
Set the effective time (timespan) of a key in milliseconds |
Pttl |
Returns the remaining valid time of key in milliseconds |
Randomkey |
A key that is randomly returned (used) from the current database |
RENAME |
Renaming a key |
Renamenx |
Rename key to Newkey when and only if Newkey does not exist |
RESTORE |
Deserializes the given serialized value and associates it with the given key |
SORT |
Returns or saves a sorted element in a given list, collection, and ordered collection key |
Ttl |
Returns the remaining valid time for a given key , in seconds |
TYPE |
Returns the type of value stored by key |
SCAN |
Incremental iterations |
Second, String
String Command Quick check:
Command |
Description |
APPEND |
Appends the value to the end of the value of the specified key and, if the key does not exist, increases the operation. |
Bitcount |
Calculates the number of bit bits that are set to 1 in the given string. |
Bitop |
Bitwise operation on one or more string keys that hold bits |
Decr |
Subtract one of the numeric values stored in the key . Key does not exist, the value of the 0,key type incorrectly returns an error. |
Decrby |
Subtracts the value stored by the key by the specified number |
GET |
Returns the string value associated with key, or returns an error if the value stored by Key is not a string type. |
Getbit |
Gets the bit on the specified offset for the string value stored by the key |
GETRANGE |
Returns a substring of the string value in key, with the intercept range of the string determined by the start and end two offsets |
Getset |
Sets the value of the given key to value and returns the old value of key. Non-string error. |
INCR |
Increase the numeric value stored in key by one. Failure to convert to a number is an error. |
Incrby |
Adds the value stored by key to the specified increment |
Incrbyfloat |
Adds the specified floating-point increment to the value stored in key |
MGET |
Returns the value of all (one or more) given key |
MSET |
Set one or more key-value pairs at the same time |
Msetnx |
Set one or more key-value pairs at the same time, if a key is already occupied, then all execution is canceled. |
Psetex |
Set the effective time of key in milliseconds |
SET |
Associating a string value to a key |
Setbit |
Sets or clears a bit (bit) on the specified offset for the string value stored by key |
Setex |
Associates a value in a key with the key's effective time (in seconds) |
Setnx |
Set to the specified value when key is not being used |
SETRANGE |
Overwrite (overwrite) the string value stored by the given key with the value parameter, starting with offset offsets |
STRLEN |
Returns the length of the string value stored by key |
Third, Hash
Hash command Quick check:
Command |
Description |
Hdel |
Deletes one or more specified domains in the hash table key, and the nonexistent fields are ignored. |
Hexists |
View Hash table key, whether a given domain field exists |
Hget |
Returns the value of the given field field in the hash table key |
Hgetall |
Returns the hash table key, all fields and values |
Hincrby |
Adds the specified increment to the value of the field field in the hash table key |
Hincrbyfloat |
Adds the specified floating-point increment to the Field field in the hash table key |
Hkeys |
Returns all the fields in the hash table key |
Hlen |
Returns the number of fields in the hash table key |
Hmget |
Returns the value of one or more given fields in a hash table key |
Hmset |
Set multiple Field-value (domain-value) pairs to the hash table key at the same time |
Hset |
Set the value of the field field in hash table key to value |
Hsetnx |
When and only if the domain field does not exist, set the value of the field field in the hash table key to value |
Hvals |
Returns the value of all fields in the hash table key |
HSCAN |
Incremental iterations |
Iv. List
List command Quick check:
Command |
Description |
Blpop |
It is a blocked version of the Lpop command, and the connection will be blocked by the Blpop command until the wait time-out or a popup element is found when no elements in the given list are available to eject |
Brpop |
Synonymous with Blpop, different pop-up positions |
Brpoplpush |
When the list source is empty, the Brpoplpush command blocks the connection until the wait time-out |
LINDEX |
Returns the element in the list key, subscript index |
Linsert |
Insert value values into List key |
Llen |
Returns the length of the list key |
Lpop |
Remove and return the header element of the list key |
Lpush |
Inserts one or more value values into the table header of the list key |
Lpushx |
Insert value values into the table header of the list key , when and only if key exists and is a list |
Lrange |
Returns the element in the specified interval in the list key , with the interval specified by the offset start and stop |
Lrem |
Removes the element in the list that is equal to the parameter value , based on the value of the parameter count |
LSET |
Set the value of the element with the list key subscript as index to value |
LTRIM |
Trim (trim) a list so that the list retains only the elements within the specified interval, and the elements that are not within the specified range are deleted |
Rpop |
Remove and return the tail element of the list key |
Rpoplpush |
Command Rpoplpush performs two actions in an atomic time: 1, pops the last element in the list source (the trailing element), and returns it to the client. 2. Insert the source popup element into the list destination, as the head element of the destination list. |
Rpush |
Inserts one or more value values into the footer of the list key |
Rpushx |
Inserts a value of values into the footer of the list key when and only if key exists and is a list |
Five, Set
Set command Quick check
Command |
Description |
Sadd |
Adding one or more member elements to the collection key, member elements that already exist in the collection will be ignored |
SCard |
Returns the number of elements in the collection of the collection key |
Sdiff |
Returns all members of a collection, which is a set of differences between all given sets |
Sdiffstore |
This command works similarly to Sdiff, but it saves the result to a new collection instead of simply returning the result set |
SINTER |
Returns all members of a collection that are the intersection of all given collections |
Sinterstore |
Similar to sinter, but can be specified to be saved to a new collection |
Sismember |
Determines whether the member element is a member of the collection key |
Smembers |
Returns all members in the collection key |
Smove |
Move member elements from one collection to another |
SPOP |
Removes and returns a random element in the collection |
Srandmember |
Simply return random elements without any changes to the collection, unlike Spop, which does not remove |
Srem |
Removes one or more member elements from the collection key, and the nonexistent member element is ignored |
Sunion |
Returns all members of a collection, which is the set of all the given collections |
Sunionstore |
Similar to sunion, but can be specified to be saved to a new collection |
Sscan |
Incremental iterations |
Liu, SortedSet
SortedSet Command Quick check:
Command |
Description |
Zadd |
Adds one or more member elements and their score values to the ordered set key |
Zcard |
Returns the cardinality of an ordered set key |
Zcount |
Returns the number of members in an ordered set key that score values between Min and Max (including the score value equals min or max) |
Zincrby |
The score value of the member member for the ordered set key plus the specified increment |
Zrange |
Returns the member within the specified range (small to large) in the ordered set key |
Zrangebyscore |
Returns a member of the ordered set key, all score values between Min and Max (including equals min or Max) |
Zrank |
Returns the rank of the member member in the ordered set key. Where ordered set members are ascending (from small to large) in order of score values |
Zrem |
Remove one or more members from an ordered set key , the nonexistent member will be ignored |
Zremrangebyrank |
Removes an ordered set key , specifying all members within the rank (rank) range |
Zremrangebyscore |
Remove ordered set key , all score values between min and Max , including members equal to min or max |
Zrevrange |
Returns the ordered set key , the member within the specified interval, and the position of the member in the score large to small arrangement |
Zrevrangebyscore |
Returns the ordered set key, where the score value is between Max and Min (the default includes all members equal to Max or min). The members are arranged in descending order of score values (from large to small) |
Zrevrank |
Returns the rank of the member member in the ordered set key. Where ordered set members are sorted by score value descending (from large to small) |
Zscore |
Returns the score value of the member member in the ordered set key |
Zunionstore |
Computes the set of a given one or more ordered sets, where the number of a given key must be specified with the Numkeys parameter and the set (result set) is stored in the new collection |
Zinterstore |
Computes the intersection of one or more ordered sets given, where the number of a given key must be specified with the Numkeys parameter and the intersection (result set) is stored in the new collection |
Zscan |
Incremental iterations |
Seven, Pub/sub
Pub/sub Command Quick check:
Command |
Description |
Psubscribe |
Subscribe to one or more channels that match a given pattern |
PUBLISH |
Send Message message to the specified channel |
PUBSUB |
PUBSUB is an introspective command to view the status of a subscription and a publishing system |
Punsubscribe |
Instructs the client to unsubscribe from all given patterns |
SUBSCRIBE |
Subscribe to information for one or more channels given |
Unsubscribe |
Instructs the client to unsubscribe from a given channel |
Eight, Transaction
Transaction Command Quick check:
Command |
Description |
DISCARD |
Cancels the transaction and discards all commands within the transaction block |
Exec |
Execute commands within all transaction blocks |
MULTI |
Mark the beginning of a transaction block |
Unwatch |
Suppress watch command for all key monitoring |
WATCH |
Monitor one (or more) key if this (or these) key is changed by another command before the transaction is executed, then the transaction will be interrupted |
Ninth, Script
Script Command Quick check:
Command |
Description |
Eval |
With the built-in LUA interpreter, you can use the EVAL command to evaluate Lua scripts |
Evalsha |
Evaluates the script cached in the server based on the given SHA1 checksum code |
SCRIPT EXISTS |
Given the SHA1 checksum of one or more scripts, returns a list of 0 and 1 indicating whether the checksum specified script has been saved in the cache |
SCRIPT FLUSH |
Clear all Lua script caches |
SCRIPT KILL |
Stops the currently running Lua script, which takes effect only if the script has not performed any write operations. This command is used primarily to terminate scripts that are running too long |
SCRIPT LOAD |
Adds script scripts to the script cache, but does not immediately execute the script |
Ten, Connection
Connection Command Quick check:
Command |
Description |
AUTH |
By setting the value of the requirepass entry in the configuration file, you can use a password to protect the Redis server |
ECHO |
Prints a specific message that is used when testing. |
Ping |
Use the client to send a PING to the Redis server, which returns a PONG if the server is functioning normally, to test whether the connection to the server is still in effect, or to measure the delay value |
QUIT |
Requests the server to close the connection to the current client |
SELECT |
Switches to the specified database, the database index number is specified with a numeric value, and 0 is the starting index value |
Xi. Server
Server Command Quick check:
Command |
Description |
Bgrewriteaof |
Performs a aof file rewrite operation. Overrides create a volume-optimized version of the current AOF file. |
BGSAVE |
Asynchronously (asynchronously) saves data from the current database to disk in the background |
CLIENT GETNAME |
Returns the name of the CLIENT SETNAME command for the connection setting |
CLIENT KILL |
To close a client with an address of ip:port |
CLIENT LIST |
Returns all client information and statistics connected to the server in a human-readable format |
CLIENT SETNAME |
Assigns a name to the current connection |
CONFIG GET |
The config get command is used to obtain configuration parameters for a running Redis server |
CONFIG Resetstat |
Reset some statistics in the INFO command |
CONFIG REWRITE |
CONFIG REWRITE command to overwrite the redis.conf file specified when starting the Redis server |
CONFIG SET |
The Config SET command dynamically adjusts the configuration of the Redis server without having to reboot |
Dbsize |
Returns the number of keys for the current database |
DEBUG OBJECT |
Debug OBJECT is a debug command that should not be used by the client |
DEBUG Segfault |
Perform an illegal memory access so that Redis crashes and is only used for BUG simulations at development time |
Flushall |
Clears data for the entire Redis server (removes all keys from all databases) |
Flushdb |
Empties all keys in the current database |
INFO |
Returns various information and statistics about the Redis server |
Lastsave |
Returns the time that the most recent Redis successfully saved data to disk, expressed in UNIX timestamp format |
MONITOR |
Print out the commands received by the Redis server in real time, and try |
PSYNC |
Internal commands for the replication feature |
SAVE |
The Save command performs a synchronous save operation that saves all data snapshots (snapshot) of the current Redis instance to the hard disk as an RDB file. In general, the save operation is rarely performed in a production environment because it blocks all clients, and the task of saving the database is typically performed asynchronously by the BGSAVE command. However, save can be used as the last resort to save data if the background child process that is responsible for saving the data unfortunately has a problem. |
SHUTDOWN |
The SHUTDOWN command performs the following actions: Stop all Clients If there is at least one save point waiting, execute the Save command If the AOF option is open, update the AOF file Turn off Redis server (server) |
Slaveof |
The slaveof command is used to dynamically modify the behavior of the Replication (replication) feature at the Redis runtime |
Slowlog |
Slow log is a journaling system used by Redis to record query execution times |
SYNC |
Internal commands for the replication feature |
Time |
Returns the current server time |
Redis Common Commands Quick Check < second >