Redis String

Redis strings commands are used to manage string values in Redis. See the syntax for using Redis string commands.

Syntax:

Example

Here, SET and GET are commands and "javatpoint" is key.

Redis String 1

Redis Strings Commands

Following is a list of some basic commands which are used to manage strings in Redis.

IndexCommandDescription
1SET key valueThis command is used to set the value at the specified key.
2GET keyThis command is used to retrieve the value of a key.
3GETRANGE key start endThis command is used to get a substring of the string stored at a key.
4GETSET key valueThis command is used to set the string value of a key and return its old value.
5GETBIT key offsetThis command is used to return the bit value at the offset in the string value stored at the key.
6MGET key1 [key2..]This command is used to get the values of all the given keys
7SETBIT key offset valueThis command is used to set or clear the bit at the offset in the string value stored at the key
8SETEX key seconds valueThis command is used to set the value with the expiry of a key
9SETNX key valueThis command is used to set the value of a key, only if the key does not exist
10SETRANGE key offset valueThis command is used to overwrite the part of a string at the key starting at the specified offset
11STRLEN keyThis command is used to retrieve the length of the value stored in a key
12MSET key value [key value ...]This command is used to set multiple keys to multiple values
13MSETNX key value [key value ...]This command is used to set multiple keys to multiple values, only if none of the keys exist
14PSETEX key milliseconds valueThis command is used to set the value and expiration in milliseconds of a key
15INCR keyThis command is used to increment the integer value of a key by one
16INCRBY key incrementThis command is used to increment the integer value of a key by the given amount
17INCRBYFLOAT key incrementThis command is used to increment the float value of a key by the given amount
18DECR keyThis command is used to decrement the integer value of a key by one
19DECRBY key decrementThis command is used to decrement the integer value of a key by the given number
20APPEND key valueThis command is used to append a value to a key

Next TopicRedis Hashes




Latest Courses