Hay diferentes comportamientos que puede indicarle a redis que cumpla cuando haya llenado su memoria.
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys->random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
el valor predeterminado es
# maxmemory-policy volatile-lru
Tal vez la mejor opción sea 'volatile-ttl', y asegúrese de que todos sus cachés incluyan las opciones :expires_in.
No soy un experto y no he hecho esto. Esto solo se basa en mi comprensión actual de redis y rieles.