Redis: Eviction Policies
Learn about the policies used by Redis to evict keys.
We'll cover the following...
Since Redis stores data in-memory, it is possible that it may give an out of memory error if the memory gets full. We can configure the max memory that Redis can use through the maxmemory
property in the redis.conf
file. By default, this property is not available in the configuration file. The syntax to define this property in the configuration file is:
maxmemory
<bytes>
We also need to define an eviction policy which will be used to evict keys in case the memory gets full. We will discuss all the eviction policies later in the lesson.
Here are a few points about memory usage in Redis:
- If
maxmemory
is not defined, Redis