Redis Strings-Redis Tutorial

Source: Internet
Author: User
Tags redis tutorial

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

Grammar
127.0. 0.1:6379> COMMAND key_name
Example
127.0. 0.1:6379>SET127.0. 0.1:6379> GET w3ckey "Redis"

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

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.

For more commands please refer to: http://redis.readthedocs.org/en/latest/index.html

Original address: http://www.manongjc.com/redis/redis_strings.html

Redis Strings-Redis Tutorial

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.