The following is a quote from the Redis FAQ, under the "What happens if Redis runs out of memory?" section:
... [you] can use the "maxmemory" option in the config file to put a limit to the memory Redis can use. If this limit is reached Redis will start to reply with an error to write commands (but will continue to accept read-only commands), or you can configure it to evict keys when the max memory limit is reached in the case you are using Redis for caching.
Redis Cloud's fixed size plans have their maxmemory set to the plan's size. You can easily configure eviction policy (referred to as maxmemory-policy) for your instance from your account's console and set it to any of the standard Redis behaviors without interrupting the service. The following list details Redis' eviction policies:
- allkeys-lru: the service evicts the least recently used keys out of all keys
- allkeys-random: the service randomly evicts keys out of all keys
- volatile-lru: the service evicts the least recently used keys out of all keys with an "expire" field set
- volatile-ttl: the service evicts the shortest time to live keys (out of all keys with an "expire" field set)
- volatile-random: the service randomly evicts keys with an "expire" field set
- no-eviction: the service will not evict any keys and no writes will be possible until morememory is freed
Furthermore, you may want to look at the Redis configuration file for more information regarding maxmemory and maxmemory-policy.