Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
index-redis-page-cache.php 17.00 KiB
<?php
/*
Plugin Name: Redis Page Cache
Plugin URI: http://eth.pw/rpc
Version: 1.0
Description: Manage settings for full-page caching powered by Redis.
Author: Erick Hitter
Author URI: https://ethitter.com/

This software is based on WP Redis Cache by Benjamin Adams, copyright 2013.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/**
 * GLOBAL CONFIGURATION
 */
global $redis_page_cache_config;

$redis_page_cache_config = array(
	'debug'                   => false,
	'debug_messages'          => '',
	'stats'                   => false,
	'cached'                  => false,
	'server_ip'               => '127.0.0.1',
	'secret_string'           => 'changeme',
	'redis_server'            => '127.0.0.1',
	'redis_port'              => 6379,
	'redis_socket'            => null,
	'redis_db'                => 0,
	'cache_version'           => 0,
	'cache_headers'           => true,
	'additional_headers'      => array( 'link', 'x-hacker', 'x-pingback' ),
	'query_strings_to_ignore' => array(), // common tracking strings are automatically excluded
	'minify'                  => false,
);

// Uncomment either option below to fix the values here and disable the admin UI
// $redis_page_cache_config['cache_duration'] = 43200;
// $redis_page_cache_config['unlimited']      = false;

// Modify this function to introduce custom handling when exceptions occur
function redis_page_cache_exception_handler( $exception ) {
	return;
}

/**
 * END GLOBAL CONFIGURATION
 *
 * DO NOT EDIT BELOW THIS LINE!
 */

// Start the timer so we can track the page load time
if ( $redis_page_cache_config['debug'] || $redis_page_cache_config['stats'] ) {
	$start = microtime();
}

// Make run-time additions to configuration
$redis_page_cache_config['current_url'] = redis_page_cache_get_clean_url();