Redis QuickStart-Redis strings (8)

Source: Internet
Author: User

The Redis string command is used to manage string values in Redis. The syntax for using the Redis String command is as follows:

Grammar

Redis 127.0.0.1:6379> COMMAND Key_name

Example

Redis 127.0.0.1:6379> SET Yiibai Redis

Ok

Redis 127.0.0.1:6379> GET Yiibai

"Redis"

In the example above, set and get are commands, and Yiibai is the key.

Redis string command

The following table shows some of the basic commands in the Redis management string:

S.N. Command & Description
1

SET Key value

This command is used to set the value in the specified key.

2

GET Key

The value that corresponds to the key.

3

GETRANGE Key Start end

Gets the substring of the string stored in a key

4

Getset Key value

Sets the string value of the key and returns the old value.

5

Getbit Key Offset

Returns the offset of a string value stored in a keyed value

6

MGET Key1 [Key2 ...]

Get all the values of the given key

7

Setbit Key Offset value

Sets or clears the string value offset for the bit stored in the key

8

Setex Key seconds value

Set value when key expires

9

Setnx Key value

Sets the value of the key only if the key does not exist

10

SETRANGE Key Offset value

Overrides the offset of a part of a string from a specified key

11

STRLEN Key

Gets the length of the value stored in the key

12

MSET key value [key value ...]

Set multiple keys and multiple values

13

Msetnx key value [key value ...]

Set multiple keys Multiple values, only when there is no presence of the key

14

Psetex Key milliseconds value

Set the millisecond value and expiration time of the key

15

INCR Key

Increase the integer value of the key one time

16

Incrby Key Increment

An integer value that increments the key by the given number

17

Incrbyfloat Key Increment

A floating-point value that increments the key by a given number

18

DECR key

An integer value that decrements the key once

19

Decrby Key Decrement

An integer value that decrements the key by a given number

20

APPEND Key value

Append value to a key

Redis QuickStart-Redis strings (8)

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.