Skip to content

The Heroku Redis Maxmemory Policy

New Course Coming Soon:

Get Really Good at Git

Heroku offers a great Redis addon, which provides 25MB of memory for free.

This amount of storage can be easily filled with just a few thousands items, depending on what you’re storing.

Heroku has a configuration option called maxmemory-policy that determines how the system will behave when the Redis database memory is filled.

By default this property is set to noeviction, which means Redis will raise an error when trying to store more data.

This is done so you realize what is happening, and once you find out that you can change this behavior, it’s time to determine how.

The various behaviors are provided by Redis itself, and they are:

It’s up to you to find the best case for your needs. Once you do have a candidate, you can apply the change using the Heroku CLI, for example:

heroku redis:maxmemory YOUR_REDIS_INSTANCE_NAME --policy volatile-lru

Here is how can I help you: