Redis command finishing

Redis

directory

EXPIRE, timeout, TTL (time to live) difference
EXPIRE expiration time
timeout timeout time
TTL survival time
actually refers to the expiration time.

Command
Redis provides a large number of command operations. There are currently about 197 commands in total.

APPEND
append operation. If the key exists and is a string, the command operation appends it; if the key does not exist, the key is created first and the value is set to the empty string. This case is similar to the SET command operation.

APPEND key value

APPEND timeseries "fixed-size sample"



AUTH
Request authentication to a password-protected Redis server. Redis requires password authentication before allowing clients to perform command operations. This is achieved through the requirepass directive in the configuration file.
AUTH password


BGREWRITEAOF
informs Redis to start an AOF (Append Only File, only append file) rewriting process. This rewrite process will create a small optimized version based on the current AOF (Append Only File). If the BGREWRITEAOF command operation fails, there will be no data loss, and the old AOF (Append Only File) will remain as it is. If there is no background process for persistence, the rewrite process is only triggered by Redis.

BGREWRITEAOF

COMMAND

COMMAND
returns details of all commands supported by Redis.

EXISTS

EXISTS key [key...]
Returns whether the key exists.


EXPIRE

EXPIRE key seconds
Set the expiration time of the key, in seconds. After expiration, the key and the corresponding value will be automatically deleted.
The expiration time is only cleared by delete or update operations, such as DEL, SET, GETSET and all *STORE command operations.
When a key is converted to a persistent key via the PERSIST command, the expiration time is also cleared.
If a key is renamed using the RENAME command, the TTL associated with the key will be passed to the new key.
If you use the RENAME command to overwrite and update a key, such as:
there is a key: key_a, after using RENAME key_b key_a to overwrite and update key_a, regardless of whether key_a has an associated expiration time, the new key_a will inherit the characteristics of key_b.

EXPIREAT

EXPIREAT key timestamp is

similar to EXPIRE command. Set the expiration time by specifying a unix timestamp, in seconds, representing the number of seconds from January 1970 to the present.

FLUSHALL

FLUSHALL
deletes all keys from all DBs, not just the currently selected DB. Executing the command does not fail.


FLUSHDB

FLUSHDB
Delete all keys from the currently selected DB. Executing the command does not fail.

GET

GET key

read operation, only used to read strings. Returns null if the key does not exist. If the value corresponding to the read key is not a string, an error is returned.

GETSET
GETSET key value

atomic operation, sets the value corresponding to the key to the new value, by returning the old value before the update. If the key exists, but the set value is not a string, an error is returned.

HGET

HGET key field
returns the value of the associated field in the hash key. Returns null if the hash key does not exist or the field does not exist in the hash key.

HSET
HKEYS key
returns all field fields (key) in the specified hash (key)
HLEN
HLEN key
returns the number of fields in the specified hash (key).

HMGET
HMGET key field [field ...]
Returns the value of the associated field in the specified hash (key). If one of the fields does not exist, the corresponding return value is null.
A hash (key) that does not exist is treated as an empty hash, so if the hash (key) does not exist, HMGET returns a null list.

HMSET
HMSET key field value [field value ...]
Set a set of fields and corresponding values ​​to the hash (key). If a field already exists, overwrite the corresponding value. If the hash (key) does not exist, a hash (key) will be created.


HSET
HSET key field value
hash key set operation, the key corresponds to a hash structure. Insert a key as field and value as key/value of the specified value in the hash key. If the hash key does not exist, create a hash key, if the field already exists, overwrite the original value.

HSETNX

HSETNX key field value
When the specified field does not exist in the hash (key), set the field and associated value in the hash (key). If the hash (key) does not exist, a hash (key) will be created. If the field already exists, the HSETNX command has no effect.

HSTRLEN
HSTRLEN key field
returns the length of the string corresponding to the value of the specified field in the hash (key). Returns 0 if the hash (key) or field does not exist.
HVALS
HVALS key
returns all associated values ​​in the hash (key). Returns an empty list if the hash (key) does not exist.

INCR
INCR key
adds 1 to the value corresponding to the key.

INCRBY
INCRBY key increment
Add the value corresponding to the key to the specified value. If the key does not exist, set the key to 0 before performing this operation. If the value corresponding to the key is an illegal type or a string (cannot represent an integer), an error is returned. This operation is restricted to 64-bit signed integers only.

INCRBYFLOAT
INCRBYFLOAT key increment
is similar to INCRBY for floating point numbers.


SET

SET key value [EX seconds] [PX milliseconds] [NX|XX]

Set the key and associate a string. If the key already has a value associated with it, an overwrite update is made regardless of its type. After the SET operation is successfully executed, the TTL time-to-live associated with the key is no longer valid.

Parameter options
Since Redis 2.6.12, some parameter settings are supported.
EX seconds Set the expiration time in seconds.
PX milliseconds Set the expiration time in milliseconds.
NX is only used to set the key and associate it with a certain value when the key does not exist. .
XX is only used to set the key and associate it with a certain value when the key exists.

SETEX

SETEX key seconds value
Sets the key and associates it with a value, and specifies an expiration time in seconds. This operation is equivalent to:

SET mykey value
EXPIRE mykey seconds

SETNX

SETNX key value

Useful if the key does not exist, set the key and associate it with a value. If the key already has a value associated with it, do nothing.

TTL

TTL key

returns the remaining time to live (TTL, time to live)



http://redis.io/commands
http://redis.io/topics/rdd
http://redis.io/topics/protocol

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327030105&siteId=291194637