Redis commands that must be in Linux

Source: Internet
Author: User
Tags lua sha1 sub command redis server

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 Check the given Key whether there is
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 matches a given pattern pattern of the key; KEYS * matches all Key;keys H?llo matching Hello,hallo in the database. KEYS H[ae]llo matches Hello and Hallo
MIGRATE will be Key is atomically transferred from the current instance to the specified database on the target instance, and once the transfer is successful, Key is guaranteed to appear on the target instance, and the current instance Key will be 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 removes the given Key the effective Time
Pexpire set in milliseconds Key the effective Time
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 the given list, collection, ordered collection Key The sorted elements in the
Ttl in seconds, returns the given Key the remaining valid time
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 computes the given string, set to 1 the number of bit bits.
Bitop A string that holds bits for one or more Key Perform bit operations
Decr will be Key minus one of the numeric values stored in the 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 K ey 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 will be Key add one to the value stored in the 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 return Key The length of the stored string value

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 return hash Table key in the given domain Field the value
Hgetall return 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 return hash table key The number of domains in
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 the hash table Key The fields in Field the value is set 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 return Hash Table Key values for all fields in
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 the value value Insert to List Key among
Llen Return to list Key the length
Lpop Remove and return a list Key the head element
Lpush set one or more values value Insert to List Key the table header
Lpushx the value value Insert to List Key header, when and only if the Key exists and is a list
Lrange Return to list Key The element within the specified interval, with the interval offset Start and the Stop Specify
Lrem according to the parameters Count Remove the value from the list with the parameter value Elements of Equality
LSET the list Key Subscript is Index the value of the element is set 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 a list Key the tail element
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 set one or more values value Insert to List Key the end of the table
Rpushx the value value Insert to List Key the end of the table, 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 Judging member whether the element is a collection Key members of
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 returning an ordered set Key the cardinality
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 To remove an ordered set Key one or more members in, non-existent members will be ignored
Zremrangebyrank To remove an ordered set Key , specify all members within the rank (rank) range
Zremrangebyscore To remove an ordered set Key in, all score value is between min and the Max (including members equal to min or max )
Zrevrange returning an ordered set Key , members within the specified interval, and the member positions are arranged score large to small
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 the information message send 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
EV AL with the built-in LUA interpreter, you can use the EVAL command to evaluate a LUA script
evalsha based on the given SHA1 checksum code, Evaluate scripts that are cached in the server
SCRIPT EXISTS Given the SHA1 checksum of one or more scripts, returns a containing   TT class= "docutils literal" >0   and   1 A list of   that indicates whether the script specified by the checksum has been saved in the cache
script FLUSH Clear All Lua script cache
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   script, script   added to the script cache, but does not immediately execute the script

10, Connection

Connection Command Quick check:

Command Description
AUTH by setting the configuration file Requirepass the value of the item, You can use a password to protect the Redis server
ECHO print a specific message message , 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 switch to the specified database, database index number Index specified with a numeric value to 0 as the starting index value
11. 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 commands that must be in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.