09-10-2023, 08:49 AM
How to Use Redis Commands
There are several different groups of commands in Redis, including:
- String commands
- List commands
- Set commands
- Hash commands
- Sorted set commands
- Pub/Sub commands
Here, we have listed some of the commands used in the Redis prompt:
Redis-server /path/redis.conf– This Redis config command starts Redis with the particular configuration file.Redis-cli– A command to run the Redis CLI client.APPEND key value– Append a value to a key.BITCOUNT key [start end]– Sets the number of set bits in a string.SET key value– Set a value in a key.EXPIRE key 120– Expire a key in 120 seconds.INCR key– Increment the value in a key.KEYS pattern– Finds all keys matching a particular pattern.DEL key– Deletes a key.STRLEN key– Get the length of a key.MSET key value [key value …]– Set multiple keys and value pairs.MGET key [key …]– Get values from multiple keys.GETSET key value– Sets a new value while returning the old value.INCRBY key increment– Increase key count.DECRBY key increment– Decrease key count.

