Data Eviction
To prevent memory exhaustion, Redis uses various strategies for data eviction when it reaches its memory limit. Common eviction policies include:
- LRU (Least Recently Used): Removes the least recently accessed keys first.
- LFU (Least Frequently Used): Removes the least frequently accessed keys.
- TTL (Time To Live): Keys with an expiration time are removed when they expire.
- No Eviction: Redis can be configured to reject write operations when memory is full, ensuring no data loss.
These eviction policies help Redis maintain optimal memory usage while preserving essential data.
How does Redis store data?
Redis is an in-memory data store. It stores data primarily in RAM, allowing extremely fast read and write operations. The data is organized using key-value pairs, where keys are unique identifiers, and values can be of different types, including strings, lists, sets, sorted sets, hashes, bitmaps, and more. Data in Redis is accessed by keys, making it a highly efficient and simple data store.
Important Topics for How Redis Stores data
- Data Structures in Redis
- Persistence Options in Redis
- Partitioning in Redis
- Virtual Memory in Redis
- Data Eviction