Redis String – Commands to manage a string value in redis datastore
5 years ago Lalit Bhagtani 0
Strings are a sequence of characters, In Redis, strings can be store as a value at key and various redis commands are used to store, manage and retrieved a string value stored in redis database. The syntax for using redis commands is as follows :-
Syntax :-
redis host:post> <Command Name> <key name>
Example :-
Redis String Value Commands :-
Some of the important commands to manage string value in redis database are as follows :-
S.No | Command | Description |
---|---|---|
1 | SET | Set string value at a key |
2 | GET | Returns string value of a key |
3 | GETSET | Sets new string value and returns old string value of a key |
4 | GETRANGE | Returns substring of a string value stored at a key |
5 | GETBIT | Returns bit value by index of string value stored at a key |
6 | MGET | Returns string value of one or more keys |
7 | SETBIT | Set bit value by index to string value stored at a key |
8 | SETEX | Set string value at a key with timeout in seconds |
9 | SETNX | Set string value at a key, only if key does not exist |
10 | SETRANGE | Update part of string value stored at a key |
11 | STRLEN | Returns the length of string value stored at a key |
12 | MSET | Set multiple string value at their respective keys |
13 | MSETNX | Set multiple string value at their respective keys, only if key does not exist |
14 | PSETEX | Set string value at a key with timeout in milliseconds |
15 | INCR | Increment the integer value by one stored as string value at a key |
16 | INCRBY | Increment the integer by specified value stored as string value at a key |
17 | INCRBYFLOAT | Increment the float by specified value stored as string value at a key |
18 | DECR | Decrements the integer value by one stored as string value at a key |
19 | DECRBY | Decrements the integer by specified value stored as string value at a key |
20 | APPEND | Append string to a existing string value stored at key |
21 | BITCOUNT | Count the number of set bits (population counting) in a string |
22 | BITFIELD | Performs operation on multiple bits |
23 | BITOP | Performs bitwise operation on multiple keys and store result in destination key |
24 | BITPOS | Returns the position of first bit set to 1 or 0 in a string. |
References :-
That’s all for Redis string value and commands used to store and manage it in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.