Redis for Nosql: string data type and operation commands

Source: Internet
Author: User
Strings type :? Set the value corresponding to KEY to STRING type value .? The simplest data is binary secure. Can it contain any data .? For example, JPG images or serialized objects .?? Operation: setnamevalue ;?? 2: setnx sets the value corresponding to the KEY to a STRING type value. If the key already exists, 0 is returned; 3: setex? Set

Strings type :? Set the value corresponding to KEY to STRING type value .? The simplest data is binary secure. Can it contain any data .? For example, JPG images or serialized objects .?? Operation: set name value ;?? 2: setnx sets the value corresponding to the KEY to a STRING type value. If the key already exists, 0 is returned; 3: setex? Set

Strings type:
? Set the value corresponding to the KEY to a value of the STRING type.
? The simplest data is binary secure. It can contain any data.
? For example, JPG images or serialized objects.
?? Operation: set name value;
??
2: setnx sets the value corresponding to the KEY to the STRING type value. If the key already exists, return 0;

3: setex? Set the value of the KEY to a value of the STRING type and specify the validity period of the KEY value.
?? Setex twnmae 10 red;
??
4: setrange sets the substring of the value of the specified KEY.
??
?? Setrange name 6 tangwen.org ?? Replace the value with tangwen.org.

5: mset sets the value of multiple keys at a time. 0 k is returned for success, and 0 is returned for failure;

? Mset key1 value1 key2 value2
6: getset
? Set the new value of the key and return the old value of the key.

7: getrange gets the substring.
? Getrange name 0, 6? Returns the subscripts starting from 0 to 6.
8: mget
? Batch query. If the corresponding KEY does not exist, nil is returned.

9: incr
?? The value of the KEY increases progressively.

10: incrby
? Incrby key 5; increments by five keys.
For example:
Redis 127.0.0.1: 6379> set key1 12
OK
Redis 127.0.0.1: 6379> get key1
"12 ″
Redis 127.0.0.1: 6379> incr key1
(Integer) 13
Redis 127.0.0.1: 6379> incrby key1 2
(Integer) 15
Redis 127.0.0.1: 6379>
11: decr: subtract the key value.
12 decrby is similar to decr, and the specified value is subtracted.

13: append the value to the string of the specified KEY, and return the length of the new string value.

Install Nosql Redis in centos

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.