Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis series-4, Redis command

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Key command, string command, hash command, list command, set (ordered set) command, server command 1, Redis key command S.N. Command & describe 1DEL key

This command removes the key if there is a 2DUMP key

This command returns the serialized version of the value stored in the specified key. 3EXISTS key

This command checks to see if the key exists. 4EXPIRE key seconds

Specify the expiration time of the key 5EXPIREAT key timestamp

The specified key expiration time. Here, the time is in the Unix timestamp format 6PEXPIRE key milliseconds

Set key to expire 7PEXPIREAT key milliseconds-timestamp in milliseconds

The setting key is specified in the Unix timestamp as millisecond expiration 8KEYS pattern

Find all keys 9MOVE key db that match the specified pattern

Move the key to another database 10PERSIST key

Remove expired key 11PTTL key

Gets the expiration key for the remaining time in milliseconds. 12TTL key

Gets the remaining time for the key to expire. 13RANDOMKEY

Returns the random key 14RENAME key newkey from Redis

Change the name of the key 15RENAMENX key newkey

Rename key, if the new key does not exist 16TYPE key

Returns the value of the data type stored in the key.

2. Redis string command S.N. Command & describe 1SET key value

This command is used to set the value 2GET key in the specified key

The value corresponding to the key. 3GETRANGE key start end

The substring of the resulting string is stored in a key 4GETSET key value

Sets the string value of the key and returns the old value 5GETBIT key offset

Returns the offset 6MGET key1 [key2..] of the string value stored in the key value

Get the values of all the given keys 7SETBIT key offset value

Sets or clears the bit offset 8SETEX key seconds value in the string value stored in the key

Set the value 9SETNX key value when the key expires

Sets the value of the key only if the key does not have a 10SETRANGE key offset value

Overrides part of the string from the offset 11STRLEN key of the specified key

Get the length 12MSET key value [key value...] of the value stored in the key

Set multiple keys and multiple values 13MSETNX key value [key value...]

Set multiple keys and multiple values, 14PSETEX key milliseconds value only when there is no key

Set the millisecond value and expiration time 15INCR key of the key

Increase the integer value of the key once 16INCRBY key increment

The integer value 17INCRBYFLOAT key increment of a given number of incrementing keys

The floating-point value 18DECR key of a given number of incrementing keys

The integer value 19DECRBY key decrement of the decreasing key once

The integer value 20APPEND key value of a given number of decreasing keys

Add a value to a key 3, Redis hash command S.N. Command and description 1HDEL key field2 [field2]

Delete one or more hash fields 2HEXISTS key field

Determine whether a hash field exists or not 3HGET key field

Gets the value 4HGETALL key stored in the specified key hash field

Let all fields and values in the specified key be stored in a hash 5HINCRBY key field increment

The integer value 6HINCRBYFLOAT key field increment of the hash field incremented by a given number

The floating-point value 7HKEYS key of a given incremental hash field

Get all 8HLEN key in the hash field

Get the number of hash fields 9HMGET key field1 [field2]

Get the value of all given hash fields 10HMSET key field1 value1 [field2 value2]

Set multiple values of multiple hash fields 11HSET key field value

Set the string value 12HSETNX key field value of the hash field

Set the value of the hash field only if there is no 13HVALS key in the field

Get all the values in the hash 14HSCAN key cursor [MATCH pattern] [COUNT count]

Incremental iterative hash field and related values 4. Redis list command S.N. Command & describe 1BLPOP key1 [key2] timeout

Take out and get the first element in the list, or block until a 2BRPOP key1 [key2] timeout is available

Take out and get the last element in the list, or block until a 3BRPOPLPUSH source destination timeout is available

Pop up a value from the list, push it to another list and return it, or block until a 4LINDEX key index is available

Get the corresponding element 5LINSERT key BEFORE from the index of a list | AFTER pivot value

Insert an element 6LLEN key after or before other elements in the list

Get the length of the list 7LPOP key

Get and fetch the first element in the list, 8LPUSH key value1 [value2]

Precede a list of one or more values 9LPUSHX key value

Add a list of values before it, only if there is a 10LRANGE key start stop in the list

Get various elements 11LREM key count value from a list

Remove the element 12LSET key index value from the list

Set the value 13LTRIM key start stop of an element in the index in the list

Trim the list to the specified range 14RPOP key

Take out and get the last element in the list, 15RPOPLPUSH source destination

Delete the list of the last element, append it to another list and return it 16RPUSH key value1 [value2]

Add one or more values to the list 17RPUSHX key value

Add a list of values only if there is a set of Redis (ordered set) command S.N. Command & describe 1ZADD key score1 member1 [score2 member2]

Add one or more members to the ordered collection, or update its score 2ZCARD key if it already exists

The number of members of the ordered set obtained 3ZCOUNT key min max

Calculate the 4ZINCRBY key increment member of a member of an ordered set and a given range of values

Increase the score of the member 5ZINTERSTORE destination numkeys key [key...] in the ordered set

Multiple cross-sorted collections are stored to generate a new key ordered set. 6ZLEXCOUNT key min max

Calculate the number of ordered set members between a given dictionary range 7ZRANGE key start stop [WITHSCORES]

An ordered collection of member ranges is returned by the index. 8ZRANGEBYLEX key min max [LIMIT offset count]

Returns an ordered collection of member ranges (by dictionary scope) 9ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT]

Returns an ordered collection of member ranges by score. 10ZRANK key member

Determine the ordered collection 11ZREM key member [member...] in the index of the member.

Remove one or more member 12ZREMRANGEBYLEX key min max from an ordered collection

Delete the ordered set 13ZREMRANGEBYRANK key start stop of all members between a given dictionary range

Delete the ordered collection 14ZREMRANGEBYSCORE key min max of all members within a given index

Delete the ordered set of all members 15ZREVRANGE key start stop [WITHSCORES] within a given score

Returns an ordered collection of member ranges, sorted by scores by index, from high to low 16ZREVRANGEBYSCORE key max min [WITHSCORES]

Returns an ordered collection of members, sorted by score, from high score to low score 17ZREVRANK key member

Determine the index of the members of an ordered collection, sorted by scores, from high to low 18ZSCORE key member

Get the score associated with a given member in an ordered set 19ZUNIONSTORE destination numkeys key [key...]

Add multiple sets to sort, and the resulting sort set is stored in a new key 20ZSCAN key cursor [MATCH pattern] [COUNT count]

Incremental iterative sorting element set and related scores

6. Redis server command

S.N. Command and description 1BGREWRITEAOF

Asynchronous overwrite appends only the file 2BGSAVE

Asynchronously save the dataset to disk 3CLIENT KILL [ip:port] [ID client-id]

Kill a client's connection 4CLIENT LIST

Get the list of connections from the client to the server 5CLIENT GETNAME

Gets the name of the current connection, 6CLIENT PAUSE timeout

Stop processing the command 7CLIENT SETNAME connection-name from the client at a specified time

Sets the current connection name 8CLUSTER SLOTS

Get the mapping 9COMMAND of the cluster slot array node

Get the details array 10COMMAND COUNT of the command of Redis

The total number of Redis commands obtained 11COMMAND GETKEYS

Give sufficient Redis command to extract the key 12BGSAVE

Asynchronously save the dataset to disk 13COMMAND INFO command-name [command-name...]

Get the details of the specific Redis command array 14CONFIG GET parameter

Get the value of the configuration parameter 15CONFIG REWRITE

Configuration file 16CONFIG SET parameter value for rewritten memory configuration

The configuration parameter is set to the given value 17CONFIG RESETSTAT

Statistical 18DBSIZE returned by reset information

Returns the number of keys in the selected database 19DEBUG OBJECT key

Get a key debugging information about 20DEBUG SEGFAULT

Crash the server 21FLUSHALL

Delete all items 22FLUSHDB from all databases

Delete all items from the current database 23INFO [section]

Get information and statistics about the server 24LASTSAVE

Get the last successful UNIX timestamp saved to disk 25MONITOR

Listen for all request 26ROLE received by the real-time server

Returns the role 27SAVE of the instance in the case of replication

Synchronously save the dataset to disk 28SHUTDOWN [NOSAVE] [SAVE]

Save the synchronized dataset to disk, and then shut down the server 29SLAVEOF host port

Make the server a slave to another instance or promote it as a master 30SLOWLOG subcommand [argument]

Manage the slow query log 31SYNC of Redis

Command is used to copy 32TIME

Returns the current server time

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report