Redis is an in-memory data structure store that can be used as a database, cache, message broker, and streaming engine. Redis provides high performance, flexibility, and a rich set of data structures.
Redis Command Reference
- SET key value - Set key to hold value
- GET key - Get value of key
- DEL key - Delete a key
- INCR key - Increment the value of a key
- LPUSH key value - Insert at the head of a list
- RPUSH key value - Insert at the tail of a list
- LRANGE key start stop - Get list elements
- HSET key field value - Set field in hash stored at key
- HGET key field - Get field from hash at key
- SADD key member - Add member to set at key
- SMEMBERS key - Get all members in a set
- ZADD key score member - Add to sorted set with score
- EXPIRE key seconds - Set key expiration time
- TTL key - Get remaining time to live of a key
- FLUSHALL - Remove all keys from all databases
Redis Persistence Options
Redis provides different persistence options:
- RDB (Redis Database): Point-in-time snapshots at specified intervals
- AOF (Append Only File): Logs every write operation
- Hybrid Approach: Combines RDB and AOF for optimal durability
This simulation demonstrates in-memory operations without persistence.