Redis string (String)

Source: Internet
Author: User

Redis string (String)

The related commands for Redis string data types are used to manage Redis string values, with the following basic syntax:

Grammar
Redis 127.0.0.1:6379> COMMAND Key_name
Instance
Redis 127.0.0.1:6379> SET runoobkey redisokredis 127.0.0.1:6379> GET runoobkey "Redis"

In the above example we used the SET and GET command, the key is Runoobkey.

Redis string command

The following table lists the commonly used Redis string commands:

Serial Number Command and Description
1 SET Key value
Sets the value of the specified key
2 GET Key
Gets the value of the specified key.
3 GETRANGE Key Start end
Returns the substring of a string value in key
4 Getset Key value
Sets the value of the given key to value and returns the old value of the key.
5 Getbit Key Offset
Gets the bit on the specified offset for the string value stored by key.
6 MGET Key1 [Key2 ...]
Gets the value of all (one or more) given key.
7 Setbit Key Offset value
Sets or clears a bit (bit) on the specified offset for the string value stored by key.
8 Setex Key seconds value
Associates a value of values to a key and sets the expiration time of key to seconds (in seconds).
9 Setnx Key value
The value of key is set only if key does not exist.
10 SETRANGE Key Offset value
The value parameter is used to write to the string values stored by the key, starting with offset offsets.
11 STRLEN Key
Returns the length of the string value stored by key.
12 MSET key value [key value ...]
Set one or more key-value pairs at the same time.
13 Msetnx key value [key value ...]
Set one or more key-value pairs at the same time, when and only if all of the given keys do not exist.
14 Psetex Key milliseconds value
This command is similar to the Setex command, but it sets the lifetime of the key in milliseconds, rather than the Setex command, in seconds.
15 INCR Key
Increase the numeric value stored in key by one.
16 Incrby Key Increment
Adds the value stored by key to the given increment value (increment).
17 Incrbyfloat Key Increment
Adds the value stored by key to the given floating-point increment value (increment).
18 DECR key
Subtract one of the numeric values stored in the key.
19 Decrby Key Decrement
The value stored by key minus the given decrement value (decrement).
20 APPEND Key value
If the key already exists and is a string, the APPEND command appends value to the end of the original value of the key.

Redis string (String)

Related Article

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.