Modes
Object Cache Pro has a strict mode (default), a silent mode and a debug mode.
Strict mode
In strict
mode, all errors that occur during the object cache instantiation and initial connection are result in an exception to avoid the cache from going out of sync with the database. Additionally Object Cache Pro will be a bit more noisy and complain about anything that may go wrong.
Strict mode is enabled by default, if no prefix
is defined.
In silent mode, only emergency
, alert
, critical
and error
log levels are logged. To log other levels such as warning
, see the log_levels
configuration option.
define('WP_REDIS_CONFIG', [
'strict' => true,
]);
Silent mode
In silent mode, all errors that occur during the object cache instantiation are logged to stderr
using PHP’s error_log()
function, and if the instantiation or connection to Redis fails, it falls back to the in-memory ArrayObjectCache
, and Redis will not be used.
If the connection to Redis was established, but a Redis command fails, the error is logged to stderr
and the appropriate API value is returned, for example false
for wp_cache_get()
.
In silent mode, only emergency
, alert
, critical
and error
log levels are logged. To log other levels such as warning
, see the log_levels
configuration option.
define('WP_REDIS_CONFIG', [
'strict' => false,
'debug' => false,
]);
Debug mode
In debug mode Object Cache Pro will be a bit more noisy and complain harshly about anything that goes (or may go) wrong. It can be enabled by setting the WP_DEBUG
to true
, or via the debug
configuration option:
// Will enable Object Cache Pro's `debug` mode
define('WP_DEBUG', true);
// Alternatively enable using `debug` configuration option
define('WP_REDIS_CONFIG', [
'debug' => true,
]);
In debug mode, all errors and Redis failures will throw exceptions.