PHP Fatal error when Redis maxmemory is reached




Wordpress LScache Plugin: PHP Fatal error when Redis maxmemory is reached

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi, Litespeed recently created a PHP Fatal error when Redis reached its 10 GB Memory Limit. The server error logs were full of: Stack trace: #0 /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object-cache.cls.php(469): Redis->setex() #1 /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object.lib.php(304): LiteSpeed Object_Cache->set() #2 /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object.lib.php(332): WP_Object_Cache->set() #3 /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object.lib.php(59): WP_Object_Cache->add() #4 /var/www/vhosts/example.com/httpdocs/wp-includes/class-wp-term-query.php(883): wp_cache_add() #5 /var/www/vhosts/example.com/httpdocs/wp-includes/class-wp-term-query.php(307): WP_Term_Query->get_terms() #6 /var/www/vhosts/example.com/httpdocs/wp-includes/taxonomy.php(133 in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object-cache.cls.php on line 471 [STDERR] PHP Fatal error: Uncaught RedisException: OOM command not allowed when used memory > maxmemory. in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/litespeed-cache/src/object-cache.cls.php:469 Redis memory is now set to 20 GB and everything is working normally again. However, even this limit can be exceeded. Is there any way to invalidate the cache when the limit is reached instead of generating a fatal error? Thank you! Hi, I think there is a conf in redis to clean up , more detail: https://ma.ttias.be/redis-oom-command-not-allowed-used-memory-maxmemory/ best regards, Hi @CacheCrawler Thanks for your link. My server admin found the following: https://redis.io/topics/config If you plan to use Redis just as a cache where every key will have an expire set, you may consider using the following configuration instead (assuming a max memory limit of 2 megabytes as an example): maxmemory 2mb maxmemory-policy allkeys-lru In this configuration there is no need for the application to set a time to live for keys using the EXPIRE command (or equivalent) since all the keys will be evicted using an approximated LRU algorithm as long as we hit the ? megabyte memory limit. So he set maxmemory 128gb maxmemory-policy allkeys-lru Which seams to work well.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference