Redis string (String)
Redis string data type associated commands for managing redis string values, the basic syntax is as follows:
grammar
redis 127.0.0.1:6379> COMMAND KEY_NAME
Examples
redis 127.0.0.1:6379> SET w3bigkey redis OK redis 127.0.0.1:6379> GET w3bigkey "redis"
In the example above, we use theSET and GETcommands, key to w3bigkey.
Redis string command
The following table lists the common redis command string:
No. | Command and description |
---|---|
1 | SET key value Set the value of the specified key |
2 | GET key Gets the value of the specified key. |
3 | GETRANGE key start end Returns the value of the key sub-character string |
4 | GETSET key value Given key value is set value, and returns the key of the old value (old value). |
5 | GETBIT key offset String key value stored to get bit (bit) on the specified offset. |
6 | MGET key1 [key2 ..] Get all (one or more) of the value of a given key. |
7 | SETBIT key offset value String key value stored, set or clear bit (bit) on the specified offset. |
8 | SETEX key seconds value The value of the value associated with the key, and the key expiration time set seconds (in seconds). |
9 | SETNX key value Only set the value of key when key does not exist. |
10 | SETRANGE key offset value Cover with a value written arguments given string key value stored, offset offset from the beginning. |
11 | STRLEN key Returns the length of the string value key stored. |
12 | MSET key value [key value ...] While providing one or more key-value pairs. |
13 | MSETNX key value [key value ...] While providing one or more key-value pairs, if and only if all the given key does not exist. |
14 | PSETEX key milliseconds value This command SETEX command similar, but it set in milliseconds key lifetime, rather than SETEX command, as in seconds. |
15 | INCR key The key stored digital value is incremented by one. |
16 | INCRBY key increment The key stored value plus a given increment (increment). |
17 | INCRBYFLOAT key increment The key stored value plus the given floating-point increment (increment). |
18 | DECR key The key stored digital value minus one. |
19 | DECRBY key decrement key stored value minus the value given decrement (decrement). |
20 | APPEND key value If the key already exists and is a string, APPEND command value is appended to the end of the key original value. |
For more commands, see: http://redis.readthedocs.org/en/latest/index.html