shkola/wp-content/mu-plugins/object-cache-bootstrap.php
2026-07-12 14:34:24 +00:00

15 lines
474 B
PHP

<?php
// Auto-enable Redis object cache if available
if ( extension_loaded("redis") ) {
$host = getenv("WP_REDIS_HOST") ?: "127.0.0.1";
$port = (int)(getenv("WP_REDIS_PORT") ?: 6379);
$db = (int)(getenv("WP_REDIS_DATABASE") ?: 0);
if ( @fsockopen($host, $port, $errno, $errstr, 0.5) ) {
define("WP_REDIS_HOST", $host);
define("WP_REDIS_PORT", $port);
define("WP_REDIS_DATABASE", $db);
define("WP_CACHE", true);
}
}