Why doesn’t set a MaxTTL by default?
-
Cache is supposed to be temporary storage, not a server crasher.
If all unknown people just install this without modifying the maxttl, they just need to wait before the memory gets full and gets OOM error.Why not helps them? If you dont know how. At very least let them know its very important to change maxttl.
As a developer its very very very very very very 100x easy for you to set default maxttl. Let me tell you how:
just modify this line in your object-cache.php:
wp_cache_add( $key, $value, $group = '', $expiration = 0 ) wp_cache_replace( $key, $value, $group = '', $expiration = 0 ) wp_cache_set( $key, $value, $group = '', $expiration = 0 )You can modify like for example to this:
wp_cache_add( $key, $data, $group = '', $expiration = WP_REDIS_DEFAULT_MAXTTL ) wp_cache_replace( $key, $data, $group = '', $expiration = WP_REDIS_DEFAULT_MAXTTL ) wp_cache_set( $key, $data, $group = '', $expiration = WP_REDIS_DEFAULT_MAXTTL )Then you can set ‘WP_REDIS_DEFAULT_MAXTTL’ anywhere on your plugin directory, for example on very top of your ‘object-cache.php’, you dont need wp-config.php to change that ‘WP_REDIS_DEFAULT_MAXTTL’ const.
The topic ‘Why doesn’t set a MaxTTL by default?’ is closed to new replies.