String Commands
String commands are the most basic data type commands, which can store strings, integers, or floating-point numbers. Strings can store up to 512 MB of data.
Command List
APPEND
If the key already exists and is a string, appends the value to the end of the key
BITCOUNT
Counts the number of set bits (population counting) in a string
BITOP
Performs bitwise operations between strings and stores the result in a destination key
DECR
Decrements the numeric value stored in the key by one
DECRBY
Decrements the numeric value stored in the key by the specified value
GET
Gets the value of the specified key
GETBIT
Returns the bit value at offset in the string value stored at key
GETRANGE
Returns a substring of the string value in the key
GETSET
Sets the value of the given key to a new value and returns the old value of the key
INCR
Increments the numeric value stored in the key by one
INCRBY
Increments the numeric value stored in the key by the specified value
INCRBYFLOAT
Increments the numeric value stored in the key by the specified float value
MGET
Gets the values of all given keys
MSET
Sets one or more key-value pairs simultaneously
MSETNX
Sets the given keys to their respective values only if all the keys do not exist
SET
Sets the value of the specified key
SETBIT
Sets or clears the bit at offset in the string value stored at key
SETEX
Sets the value of a key with expiration time in seconds
PSETEX
Sets the value of a key with expiration time in milliseconds
SETNX
Sets the value of a key only if it does not exist
SETRANGE
Overwrites part of the string stored at key, starting at the specified offset, with the given value
STRLEN
Returns the length of the string value stored in the key
Use Cases
String commands are the most commonly used data type commands, suitable for various scenarios such as caching, counters, and distributed locks. Counter functionality can be easily implemented through INCR and DECR series commands.
For detailed usage and parameters of each command, please refer to the individual command documentation linked above.