redis.exceptions.ResponseError: OOM command not allowed when used memory > 'maxmemory'.
Im getting above error and I tried setting up through redis-cli, the maxmemory config is not available. It has only below attribute.
CONFIG GET *
Setting maxmemory will only solve the problem of increasing or decreasing your database size, but if you want that your Redis does not throw error when it becomes full, you have to configure maxmemory-policy
.
There is no magic here, ofcourse. When you ask Redis to not throw error when Redis is full and accomodate the new data coming in, the only option it has it to delete the old data. How exactly will it delete the data (either by recency or frequency) that is driven by the configuration maxmemory-policy
.
If you are not sure, you can go for:
maxmemory-policy allkeys-lru
which will basically delete the keys which have been least recently used (LRU). The complete list of options can be viewed here.