Redis (database)¶
Redis (Remote Dictionary Server) is a NoSQL in-memory database known for its high performance and versatility^[600-developer__redis.md]. It is frequently utilized as a data structure store, a cache layer, and a message broker (message middleware)^[600-developer__redis.md].
To bridge the gap between in-memory speed and data durability, Redis supports persistence mechanisms, including RDB (Redis Database) and AOF (Append Only File)^[600-developer__redis.md].
Architecture and Performance¶
Redis is classified as a single-threaded in-memory database, which means it avoids the overhead of context switching between threads^[600-developer__redis.md]. The primary performance bottlenecks for Redis are typically the machine's memory size and network bandwidth, rather than CPU utilization^[600-developer__redis.md].
The system employs the Reactor pattern with epoll for I/O event notification to handle high concurrency efficiently^[600-developer__redis.md].
Data Types¶
Redis supports several fundamental data types that allow it to function as a flexible data structure server^[600-developer__redis.md]:
- String: Binary-safe strings.
- List: Collections of string elements sorted by insertion order.
- Set: Unordered collections of unique strings.
- Zset (Sorted Set): Ordered collections of unique strings associated with a score.
- Hash: Maps composed of fields and values.
Basic Operations¶
To manage the database state, Redis provides commands to clear data. For instance, to delete all keys in the current database, commands such as flashall or flashdb can be used^[600-developer__redis.md].
Sources¶
^[600-developer__redis.md]