Redis common command set
Commands related to connection operations
- Quit: disconnect)
- Auth: Simple Password Authentication
Persistence
- Save: synchronize and save data to the disk.
- Bgsave: asynchronously saves data to the disk.
- Lastsave: returns the Unix timestamp from which data is successfully saved to the disk.
- Shundown: synchronize and save the data to the disk, and then close the service.
Remote Service Control
- Info: provides server information and statistics.
- Monitor: Real-time dump of received requests
- Slaveof: changes the replication policy settings
- Config: configure the redis server at runtime
Command for value operation
- Exists (key): Check whether a key exists.
- Del (key): deletes a key.
- Type (key): Type of the returned value
- Keys (pattern): returns all keys that meet the given pattern.
- Randomkey: Random return of a key space
- Keyrename (oldname, newname): Rename the key
- Dbsize: returns the number of keys in the current database.
- Expire: Set the activity time of a key (s)
- TTL: obtains the activity time of a key.
- Select (INDEX): query by index
- Move (key, dbindex): Move the key in the current database to the dbindex Database
- Flushdb: delete all keys in the selected database.
- Flushall: delete all keys in all databases
String operation command
- Set (key, value): assign value to the string named key in the database
- Get (key): returns the value of a string named key in the database.
- GetSet (Key, value): Assign the last value to the string named key.
- Mget (key1, key2 ,..., Key N): returns the value of multiple strings in the database.
- Setnx (Key, value): Add a string named key and Value
- Setex (Key, time, value): Add a string to the database and set the expiration time.
- Mset (key N, value n): Batch set values of multiple strings
- Msetnx (key N, value n): If all strings named key I do not exist
- Incr (key): Add 1 to a string named key
- Incrby (Key, integer): Add integer to the string named key
- Decr (key): String minus 1 operation whose name is key
- Decrby (Key, integer): reduce integer in the string with the name of key
- Append (Key, value): append the value of string with the name of key
- Substr (Key, start, end): returns the substring of the value of the string named key.
List Operation Command
- Rpush (Key, value): adds an element with the value at the end of the list named key.
- Lpush (Key, value): adds an element with value to the list header named key.
- Llen (key): returns the length of the list named key.
- Lrange (Key, start, end): returns the elements between start and end in the list named key.
- Ltrim (Key, start, end): truncates a list named key.
- Lindex (Key, index): returns the index position element of the list named key.
- Lset (Key, index, value): assigns a value to the element at the index position in the list named key.
- Lrem (Key, Count, value): deletes the element whose value is the value in the list of Count keys.
- Lpop (key): returns and deletes the first element from the list named key.
- Rpop (key): returns and deletes the end element of the list named key.
- Blpop (key1, key2 ,... Key N, timeout): The Block version of The lpop command.
- Brpop (key1, key2 ,... Key N, timeout): rpop block version.
- Rpoplpush (srckey, dstkey): returns and deletes the end element of the list named srckey, and adds this element to the header of the list named dstkey.
Set operation commands
- Sadd (Key, member): add the element member to the set named key.
- Srem (Key, member): deletes the element member from the set named key.
- Spop (key): Randomly returns and deletes an element in a set named key.
- Smove (srckey, dstkey, member): Move to the set Element
- Scard (key): returns the base number of a set named key.
- Sismember (Key, member): whether Member is an element of a set named key
- Sinter (key1, key2 ,... Key N): calculates the intersection.
- Sinterstore (dstkey, (KEYS): calculates and saves the intersection to the dstkey set.
- Sunion (key1, (KEYS): returns the Union set.
- Sunionstore (dstkey, (KEYS): calculates the Union and saves the Union to the collection of dstkey.
- Sdiff (key1, (KEYS): returns the difference set.
- Sdiffstore (dstkey, (KEYS): calculates the difference set and saves the difference set to the set of dstkey.
- Smembers (key): returns all elements of a set named key.
- Srandmember (key): Random return of an element of the Set named key
Hash Operation Command
- hset (Key, field, value): Add an element field to the hash named key.
- hget (Key, field): return the value of the field in the hash with the key name
- hmet (Key, (fields): return the value corresponding to field I in the hash with the key name
- hmset (Key, (fields): Add an element field to the hash named key.
- hincrby (Key, field, integer): Add integer to the field value in the hash with the key name
- hexists (Key, field): indicates whether the hash with the key as the field exists.
- hdel (Key, field): Delete the field in the hash key named key.
- hlen (key): returns the number of elements in the hash key.
- hkeys (key): returns all the keys in the hash key.
- hvals (key): return the value corresponding to all keys in the hash with the key name
- hgetall (key): returns all the keys (fields) and their corresponding values in the hash key