
# Redis Commands

## 1. String Commands
- `SET key value`: Set the value of a key.
- `GET key`: Get the value of a key.
- `MSET key value [key value ...]`: Set multiple keys to multiple values.
- `MGET key [key ...]`: Get the values of multiple keys.
- `DEL key [key ...]`: Remove one or more keys.
- `EXISTS key`: Check if a key exists.
- `EXPIRE key seconds`: Set a timeout on a key.
- `TTL key`: Get the time-to-live (TTL) of a key.
- `INCR key`: Increment the integer value of a key by one.
- `DECR key`: Decrement the integer value of a key by one.
- `INCRBY key increment`: Increment the integer value of a key by the given amount.
- `DECRBY key decrement`: Decrement the integer value of a key by the given amount.
- `APPEND key value`: Append a value to an existing key.
- `STRLEN key`: Get the length of the value stored in a key.

## 2. Hash Commands
- `HSET key field value`: Set the value of a field in a hash.
- `HGET key field`: Get the value of a field in a hash.
- `HDEL key field [field ...]`: Delete one or more hash fields.
- `HGETALL key`: Get all the fields and values in a hash.
- `HKEYS key`: Get all the field names in a hash.
- `HVALS key`: Get all the values in a hash.
- `HEXISTS key field`: Check if a field exists in a hash.
- `HINCRBY key field increment`: Increment the integer value of a field in a hash by the given amount.
- `HLEN key`: Get the number of fields in a hash.
- `HMSET key field value [field value ...]`: Set multiple fields in a hash.
- `HMGET key field [field ...]`: Get the values of multiple fields in a hash.

## 3. List Commands
- `LPUSH key value [value ...]`: Prepend one or more values to a list.
- `RPUSH key value [value ...]`: Append one or more values to a list.
- `LPOP key`: Remove and get the first element of a list.
- `RPOP key`: Remove and get the last element of a list.
- `LINSERT key BEFORE|AFTER pivot value`: Insert an element before or after a pivot element in a list.
- `LLEN key`: Get the length of a list.
- `LRANGE key start stop`: Get a range of elements from a list.
- `LREM key count value`: Remove elements from a list.
- `LSET key index value`: Set the value of an element in a list by its index.
- `LINDEX key index`: Get an element from a list by its index.
- `BLPOP key [key ...] timeout`: Block until one of the lists is not empty.
- `BRPOP key [key ...] timeout`: Block until one of the lists is not empty.

## 4. Set Commands
- `SADD key member [member ...]`: Add one or more members to a set.
- `SREM key member [member ...]`: Remove one or more members from a set.
- `SMEMBERS key`: Get all the members in a set.
- `SISMEMBER key member`: Check if a member is in a set.
- `SCARD key`: Get the number of members in a set.
- `SDIFF key [key ...]`: Get the difference between two or more sets.
- `SINTER key [key ...]`: Get the intersection of two or more sets.
- `SUNION key [key ...]`: Get the union of two or more sets.
- `SMOVE source destination member`: Move a member from one set to another.
- `SRANDMEMBER key [count]`: Get one or more random members from a set.
- `SSCAN key cursor [MATCH pattern] [COUNT count]`: Incrementally iterate the members of a set.

## 5. Sorted Set Commands
- `ZADD key score member [score member ...]`: Add one or more members to a sorted set, or update their score.
- `ZREM key member [member ...]`: Remove one or more members from a sorted set.
- `ZINCRBY key increment member`: Increment the score of a member in a sorted set.
- `ZRANGE key start stop [WITHSCORES]`: Get a range of members from a sorted set by index.
- `ZREVRANGE key start stop [WITHSCORES]`: Get a range of members from a sorted set in reverse order.
- `ZRANGEBYSCORE key min max [WITHSCORES]`: Get members of a sorted set within a score range.
- `ZREVRANGEBYSCORE key max min [WITHSCORES]`: Get members of a sorted set within a score range in reverse order.
- `ZREMRangeByScore key min max`: Remove members from a sorted set within a score range.
- `ZCARD key`: Get the number of members in a sorted set.
- `ZSCAN key cursor [MATCH pattern] [COUNT count]`: Incrementally iterate the members of a sorted set.
- `ZCOUNT key min max`: Count the number of members in a sorted set within a score range.
- `ZLEXCOUNT key min max`: Count the number of members in a sorted set within a lexicographical range.

## 6. Key Commands
- `DEL key [key ...]`: Delete one or more keys.
- `EXISTS key`: Check if a key exists.
- `RENAME key newkey`: Rename a key.
- `RENAMENX key newkey`: Rename a key only if the new key does not exist.
- `KEYS pattern`: Get all keys matching a pattern.
- `TYPE key`: Get the type of a key.
- `SCAN cursor [MATCH pattern] [COUNT count]`: Incrementally iterate the keys of the database.

## 7. Transaction Commands
- `MULTI`: Mark the start of a transaction block.
- `EXEC`: Execute all commands issued after the MULTI command.
- `DISCARD`: Discard all commands issued after the MULTI command.
- `WATCH key [key ...]`: Watch one or more keys for changes before executing a transaction.

## 8. Pub/Sub Commands
- `PUBLISH channel message`: Publish a message to a channel.
- `SUBSCRIBE channel [channel ...]`: Subscribe to one or more channels.
- `UNSUBSCRIBE [channel [channel ...]]`: Unsubscribe from one or more channels.
- `PSUBSCRIBE pattern [pattern ...]`: Subscribe to channels matching patterns.
- `PUNSUBSCRIBE [pattern [pattern ...]]`: Unsubscribe from channels matching patterns.
- `PUBSUB CHANNELS [pattern]`: Get the list of active channels, optionally matching a pattern.
- `PUBSUB NUMSUB channel [channel ...]`: Get the number of subscribers for one or more channels.
- `PUBSUB NUMPAT`: Get the number of subscriptions to patterns.

## 9. Scripting Commands
- `EVAL script numkeys key [key ...] arg [arg ...]`: Execute a Lua script.
- `EVALSHA sha1 numkeys key [key ...] arg [arg ...]`: Execute a Lua script using its SHA1 hash.
- `SCRIPT LOAD script`: Load a Lua script into Redis and return its SHA1 hash.
- `SCRIPT FLUSH`: Flush all Lua scripts from the script cache.
- `SCRIPT EXISTS sha1 [sha1 ...]`: Check if one or more Lua scripts exist in the cache.

## 10. Server Commands
- `INFO [section]`: Get information about the Redis server (e.g., memory, persistence, stats, etc.).
- `CONFIG GET parameter`: Get the value of a configuration parameter.
- `CONFIG SET parameter value`: Set the value of a configuration parameter.
- `CONFIG REWRITE`: Rewrite the configuration file based on the current in-memory configuration.
- `TIME`: Get the current server time.

## 11. HyperLogLog Commands
- `PFADD key element [element ...]`: Add elements to a HyperLogLog.
- `PFCOUNT key [key ...]`: Return the approximated cardinality of the HyperLogLogs.
- `PFMERGE destkey sourcekey [sourcekey ...]`: Merge multiple HyperLogLogs into a single one.

## 12. Bitmap Commands
- `SETBIT key offset value`: Set or clear a bit in a string value at the specified offset.
- `GETBIT key offset`: Get the bit value at the specified offset.
- `BITCOUNT key [start end]`: Count the number of set bits (1s) in a string.
- `BITOP operation destkey key [key ...]`: Perform bitwise operations (AND, OR, XOR, NOT) between one or more strings.

---

This file covers most of the Redis commands available for common data structures and functionalities. You can add more details, or modify this list depending on your specific needs! Let me know if you need further assistance.
