You can now set a memory limit and an eviction policy for self-hosted Redis and Valkey from the database's Settings tab.
Memory settings on a Redis database's Settings tab
Memory limit (MB) caps how much memory Redis uses. Leave it blank for no limit, which is how your servers run today.
When the limit is reached chooses what Redis does when it's full. You can pick any of Redis' eight policies, grouped by whether they evict any key or only keys with an expiry. Use Don't evict for Sidekiq, Action Cable or anything that can't lose data. Use an LRU or LFU policy for a cache.
Changes apply right away, without restarting Redis, and they're saved to Redis' config file so they last through restarts. If you already tuned these by hand on the server, saving changes only the setting you edited.
Be careful with eviction on a Redis that Sidekiq uses, because evicting keys can drop queued jobs. If you use Redis for both jobs and caching, consider a separate Redis for the cache.
We also fixed Redis failing to start after a reboot on servers with IPv6 disabled on loopback.