Commands related to connection operations
Persistence
-
save: Save data synchronously to disk
-
bgsave: Asynchronously saves data to disk
-
lastsave: Returns the Unix timestamp
-
shundown: Save data synchronously to disk, and then close the service
remote Service Control
-
info: Provides server information and statistics
-
monitor: real-time dump of received requests
-
slaveof: Change replication policy settings
-
config: Configure Redis Server at run time
Commands for the value operation
Exists (key): Verify that a key exists
Del (key): Delete a key
Type (key): Return value types
Keys (pattern): Returns all keys that satisfy the given pattern
Randomkey: Randomly returns one of the key spaces
Keyrename (Oldname, newname): Rename key
Dbsize: Returns the number of keys in the current database
Expire: Set the active time of a key (s)
TTL: Get the active time of a key
Select (Index): Query by index
Move (Key, Dbindex): Moves the key in the current database to the Dbindex database
FLUSHDB: Delete all keys in the currently selected database
Flushall: Delete all keys in all databases
Commands for string manipulation
Set (key, value): Assigns a value to a string named key in the database
Get (Key): Returns the value of a string named key in the database
Getset (key, value): Assigns the last value to a string named key
Mget (Key1, Key2,..., key N): Returns the value of multiple strings in the library
SETNX (key, Value): Add string, name key, value
Setex (Key, Time, value): Adds a string to the library, sets the expiration times
Mset (key n, value N): Sets the value of multiple strings in bulk
Msetnx (key n, value N): If all strings with the name key I do not exist
INCR (Key): 1 operation with a string named key
Incrby (Key, Integer): String with Name Key added integer
DECR (key): string minus 1 operation with name key
Decrby (Key, Integer): string with the name key reduced by integer
Append (key, value): String value with the name key appended value
SUBSTR (key, start, end): Returns a substring of the value of string with the name key
Commands for the list operation
Rpush (key, value): Adds an element of value to the list at the end of the name key
Lpush (key, value): Adds an element of value to the list header with the name key
Llen (Key): Returns the length of the list named key
Lrange (key, start, end): Returns the element between start and end in list named key
LTrim (key, start, end): Intercepts the list named key
Lindex (key, index): Returns the element of the index position in the list named key
LSet (key, index, value): Assigns a value to the element of the index position in the list named key
Lrem (Key, Count, value): Deletes the value in the list of Count key elements
Lpop (Key): Returns and removes the first element in a list named key
Rpop (Key): Returns and Deletes the tail element in the list named key
Blpop (Key1, Key2,... key N, timeout): The block version of the Lpop command.
Brpop (Key1, Key2,... key N, timeout): The block version of Rpop.
Rpoplpush (Srckey, Dstkey): Returns and removes the tail element of the list named Srckey, and adds the element to the head of the list named Dstkey
Commands for set operations
Sadd (Key, member): Adds an element to a set named Key member
Srem (Key, member): Removes the element in the set named Key member
Spop (key): Randomly returns and deletes an element in a set with the name key
Smove (Srckey, Dstkey, member): Move to the collection element
SCard (Key): Returns the cardinality of a set named key
Sismember (Key, member): Member is a set element with the name key
Sinter (Key1, Key2,... key N): Intersection
Sinterstore (Dstkey, (keys)): Seek the intersection and save the intersection to the collection of Dstkey
Sunion (Key1, (keys)): Seek and set
Sunionstore (Dstkey, (keys)): Sets and saves the assembly to the Dstkey collection
Sdiff (Key1, (keys)): Differential set
Sdiffstore (Dstkey, (keys)): Differential set and save the difference set to the collection of Dstkey
Smembers (Key): Returns all elements of a set with the name key
Srandmember (key): Randomly returns an element of a set with the name key
Commands for hash operations
Hset (Key, field, value): Adds an element to a hash named key field
Hget (Key, field): Returns the value of field corresponding to the hash named key
Hmget (Key, fields): Returns the value of field I in the hash named key
Hmset (Key, fields): Adds an element to a hash named key field
Hincrby (Key, field, integer): Adds an integer to the value of field in the hash named key
Hexists (Key, field): A field with the key field in the hash named key
Hdel (Key, field): Delete The field with the key field in the hash named key
Hlen (Key): Returns the number of elements in a hash with the name key
Hkeys (Key): Returns all keys in a hash with the name key
Hvals (Key): Returns the value corresponding to all keys in a hash with the name key
Hgetall (Key): Returns all keys (field) and their corresponding value in a hash with the name key
Redis Main commands