Leilin Peng Share: Redis string (String)

  Redis string data type for managing the commands redis string value, the basic syntax is as follows:

  grammar

  redis 127.0.0.1:6379> COMMAND KEY_NAME

  Examples

  redis 127.0.0.1:6379> SET coderctokey redis

  OK

  redis 127.0.0.1:6379> GET coderctokey

  "redis"

  In the above example we used the GET and SET commands, key to coderctokey.

  Redis string command

  The following table lists common redis command string:

  Number and description of command

  1SET key value

  Setting the value of the specified key

  2GET key

  Gets the value of the specified key.

  3GETRANGE key start end

  Returns string key value substring

  4GETSET key value

  Set the value of a given key value, and returns the key of the old value (old value).

  5GETBIT key offset

  Key string stored value, obtaining bits (bit) on the specified offset.

  6MGET key1 [key2..]

  Get all (one or more) of values ​​of the given key.

  7SETBIT key offset value

  String stored key value, set or clear the bits (bit) on the specified offset.

  8SETEX key seconds value

  The value associated with the value key, and the key seconds The expiration time is set (in seconds).

  9SETNX key value

  Only settings key in the key does not exist.

  10SETRANGE key offset value

  Cover addressed by the value parameter values ​​given string stored key, offset offset from the start.

  11STRLEN key

  Returns the length of the string stored key value.

  12MSET key value [key value ...]

  Simultaneously providing one or more key-value pair.

  13MSETNX key value [key value ...]

  Simultaneously providing one or more key-value pairs, if and only if all the given key does not exist.

  14PSETEX key milliseconds value

  This command and SETEX command similar, but it is set in milliseconds survival key is, rather than as SETEX command, in seconds.

  15INCR key

  The key stored in a digital value incremented by one.

  16INCRBY key increment

  The key the stored value plus a given incremental value (increment).

  17INCRBYFLOAT key increment

  The key stored in a floating-point value plus the increment value given (increment).

  18DECR key

  The key stored digital value minus one.

  19DECRBY key decrement

  key value stored by the given decrement value (decrement).

  20APPEND key value

  If the key already exists and is a character string, APPEND command specified key value appended to the original value (value) of.

  More commands, refer to: https: //redis.io/commands (edit: Leilin Peng Source: network intrusion deleted)

Guess you like

Origin www.cnblogs.com/pengpeng1208/p/11263878.html