Redis command Summary

Source: Internet
Author: User
Connection operation-related command quit: close connection auth: Simple Password Authentication persistent save: save data synchronously to disk bgsave: save data asynchronously to disk lastsave: returns the last time the data was successfully saved to the disk Unix timestamp shundown: synchronize and save the data to the disk, and then disable the service remote service control in

Connection operation-related command quit: close connection auth: Simple Password Authentication persistent save: save data synchronously to disk bgsave: save data asynchronously to disk lastsave: returns the last time the data was successfully saved to the disk Unix timestamp shundown: synchronize and save the data to the disk, and then disable the service remote service control in

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 the names are key? None of I's strings 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): Add a value to the list header named key? Element
  • 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 )? : Delete the element member in the set named key.
  • Spop (key )? : Random return and deletion of an element in a set named key
  • Smove (srckey, dstkey, member )? : Move to collection Element
  • Scard (key )? : Returns the base number of a set named key.
  • Sismember (key, member )? : Whether member is a set element named key
  • Sinter (key1, key2 ,... Key N )? : Intersection
  • Sinterstore (dstkey, (keys ))? : Calculates and saves the intersection to the dstkey set.
  • Sunion (key1, (keys ))? : Union set
  • Sunionstore (dstkey, (keys ))? : Calculates the Union set and saves the Union set to the dstkey set.
  • Sdiff (key1, (keys ))? : Difference set
  • Sdiffstore (dstkey, (keys ))? : Calculates the difference set and saves the difference set to the dstkey set.
  • Smembers (key )? : Returns all elements of a set named key.
  • Srandmember (key )? : Returns an element of a set named key at random.

Hash Operation Command

  • Hset (key, field, value): Add an element field to the hash named key.
  • Hget (key, field): returns the value of the field in the hash with the key name.
  • Hmet (key, (fields): returns the field? I value
  • Hmset (key, (fields): adds an element field to the hash named key.
  • Hincrby (key, field, integer): adds an integer to the field value in the hash named key.
  • 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 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.

Original article address: Redis command summary, thanks to the original author for sharing.

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.