English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The commands related to the Redis string data type are used to manage Redis string values, with basic syntax as follows:
redis 127.0.0.1:6379> COMMAND KEY_NAME
redis 127.0.0.1:6379> SET w3codeboxkey redis OK redis 127.0.0.1:6379> GET w3codeboxkey "redis"
In the above examples, we used SET and GET Command, key as w3codeboxkey.
The following table lists common redis string commands:
Serial number | Command and description |
---|---|
1 | SET key value Set the value of the specified key |
2 | GET key Get the value of the specified key. |
3 | GETRANGE key start end Return the substring of the string value in key. |
4 | GETSET key value Set the value of the given key to value and return the old value (old value) of key. |
5 | GETBIT key offset Get the bit at the specified offset of the string value stored at key. |
6 | MGET key1 [key2..] Get the value of all (one or more) given keys. |
7 | SETBIT key offset value Set or clear the bit at the specified offset of the string value stored at key. |
8 | SETEX key seconds value Associate the value value with key and set the expiration time of key to seconds (in seconds). |
9 | SETNX key value Set the value of key only if the key does not exist. |
10 | SETRANGE key offset value Use the value parameter to overwrite the string value stored at the given key, starting from the offset offset. |
11 | STRLEN key Retorna o comprimento da string armazenada pelo key. |
12 | Definir um ou mais keys ao mesmo tempo Definir um ou mais keys ao mesmo tempo-value se todos os keys fornecidos não existirem. |
13 | MSETNX key value [key value ...] Definir um ou mais keys ao mesmo tempo-value se todos os keys fornecidos não existirem. |
14 | PSETEX key milliseconds value Este comando é semelhante ao comando SETEX, mas define o tempo de vida do key em milissegundos, ao invés de segundos como o comando SETEX. |
15 | INCR key Incrementa o valor armazenado pelo key em um. |
16 | INCRBY key increment Adiciona o valor increment ao valor armazenado pelo key. |
17 | INCRBYFLOAT key increment Adiciona o valor flutuante increment ao valor armazenado pelo key. |
18 | DECR key Diminui o valor armazenado pelo key em um. |
19 | DECRBY key decrement Subtrai o valor decremento do valor armazenado pelo key. |
20 | APPEND key value Se o key já existir e for uma string, o comando APPEND adicionará o valor especificado ao final do valor original do key. |
Mais comandos, consulte:https://redis.io/comandos