Redis data types String use

Redis is the most basic string data type that is capable of storing any type of string containing binary data. Can be used to store mailboxes, JSON object oriented, or even a picture, a string allows a maximum storage capacity of 512MB. String is the basis for the other four types, in different ways to distinguish from several other types of tissue is essentially just a string.

 

And the operation command string corresponding api Redis follows:


SET [Key] [value]
JedisAPI: public String SET (Final String Key, Final String value)
Function: Set value

SETNX [key] [value]
JedisAPI: public Long SETNX (Final String key, String value Final)
function: If the key exists, 0 is returned does not take effect modification

SETEX [Key] [time] [value]
JedisAPI: public String SETEX (Final String Key, int seconds The Final, Final String value)
Function: Specifies the time period for the second

SetRange [key] n [string]
JedisAPI: Long public SetRange (Final String key, offset Final Long, String value Final)
Function: a character key corresponding to the value of n bits after the first string is replaced

mset [key1] [value1] [key2] [value2] ……
JedisAPI:public Long setnx(final String key, final String value)
功能:无

msetnx
JedisAPI: No
Function: SETNX Similarly, a plurality of key values, that if present, the modification does not take effect and returns 0

GET [key]
JedisAPI: public String GET (Final String key)
Function: Get value corresponding key

GetSet [key] [value]
JedisAPI: (Final String key, String value Final) public String getset
Function: Set key value, and return the old value of the key

GetRange [key] n1 n2
JedisAPI: public String GetRange (Final String key, Final startOffset Long, Long Final endOffset)
Function: Get index position corresponding to the key value from the string of n1 to n2

mget [key1] [key2] [key3] ......
JedisAPI: No
Function: acquiring a plurality of corresponding key value, and if not, nil is returned

incr [key]
JedisAPI: public Long incr (Final String key)
Function: the value of key for adding an operation, if incr a nonexistent value, the q-value of 1, if the key corresponding to the value is not an int return an error : -ERR value is not an integer or out of range

incrby [Key] [NUM]
JedisAPI: public Long incrBy (Final String key, Final Long Integer)
Function: Add the specified value, key does not exist when it will set the key, and the original value is considered 0

DECR [key]
JedisAPI: Long public DECR (Final String key)
function: the key value of do is decremented, a DECR key does not exist, then the set key is -1

decrby [key] [num]
JedisAPI: public Long decrBy (Final String key, Long Integer Final)
Function: subtracting a value corresponding to the key num

the append [key] [string]
JedisAPI: public Long the append (Final String key, String value Final)
Function: string appended to the key value corresponding to the end, returns the length of the new string

strlen [key]
JedisAPI: public Long strlen (Final String key)
Function: read key value corresponding to the length of

Guess you like

Origin www.cnblogs.com/max-hou/p/11327732.html