What are some common commands used in Redis?
Commonly used commands in Redis include:
- SET: Set the value of the specified key.
- GET: Retrieve the value of a specified key.
- DEL: Remove the specified key.
- Check if the specified key exists.
- KEYS: Retrieve all key names.
- TTL: Get the remaining time to live for a key.
- EXPIRE: Set a key’s expiration time.
- INCR: Increase the value of the key by 1.
- DECR: Decrease the value of the key by 1.
- HSET: Sets a field in a hash table.
- HGET: Retrieve the value of a field in a hash table.
- HMSET: Set multiple fields in a hash map at once.
- HMGET: Retrieve multiple hash field values at once.
- LPUSH: Insert one or more values at the head of a list.
- RPUSH: Insert one or more values at the end of a list.
- LPOP: Remove and return the first element of the list.
- RPOP: Remove and return the last element of the list.
- SADD: Add one or more members to a set.
- SREM: Remove one or more members from the set.
- SMEMBERS: Retrieve all members from a set.
- ZADD: Add one or more members to a sorted set.
- ZRANGE: Retrieve members within a specified range in a sorted set.
- ZSCORE: Get the score of a specific member in a sorted set.
- ZREM: Remove one or more members from a sorted set.
- PUBLISH: Send the message to the specified channel.
- SUBSCRIBE: Receive messages from one or more channels by subscribing.
- UNSUBSCRIBE: Cancel your subscription to one or more channels.
- EVAL: Execute Lua scripts on the server side.
- SCAN: Iterate over the keys in the database.
- FLUSHDB command clears all keys in the current database.