Commit 0bc66a24 authored by Hendrik Klemp's avatar Hendrik Klemp
Browse files

Fix Typo

Fixed Typo
parent 50fded33
...@@ -10,16 +10,13 @@ function getMicroTime($t) ...@@ -10,16 +10,13 @@ function getMicroTime($t)
} }
$debug = false; $debug = true;
$cache = false;
$ip_of_your_website = '127.0.0.1'; $ip_of_your_website = '127.0.0.1';
$secret_string = 'changeme'; $secret_string = 'changeme';
if(!defined('WP_USE_THEMES')) {
define('WP_USE_THEMES', true);
}
// so we don't confuse the cloudflare server // so we don't confuse the cloudflare server
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
...@@ -56,6 +53,7 @@ try { ...@@ -56,6 +53,7 @@ try {
// This page is cached, lets display it // This page is cached, lets display it
} else if ($redis->exists($redis_key)) { } else if ($redis->exists($redis_key)) {
$cache = true;
$html_of_page = $redis->get($redis_key); $html_of_page = $redis->get($redis_key);
echo $html_of_page; echo $html_of_page;
...@@ -81,9 +79,9 @@ try { ...@@ -81,9 +79,9 @@ try {
// When a page displays after an "HTTP 404: Not Found" error occurs, do not cache // When a page displays after an "HTTP 404: Not Found" error occurs, do not cache
// When the search was used, do not cache // When the search was used, do not cache
if (!is_404() && !is_search()) { if ((!is_404()) and (!is_search())) {
if ($unlimited) { if ($unlimited) {
$redis->setex($redis_key, $html_of_page); $redis->set($redis_key, $html_of_page);
} }
else else
{ {
...@@ -106,16 +104,16 @@ try { ...@@ -106,16 +104,16 @@ try {
require('./wp-blog-header.php'); require('./wp-blog-header.php');
} }
if ($_SERVER['REMOTE_ADDR'] != $ip_of_your_website) {
// How long did it take to load the page? (CloudFlare may strip out comments) $end = microtime();
$end = microtime(); $time = (@getMicroTime($end) - @getMicroTime($start));
$time = (@getMicroTime($end) - @getMicroTime($start)); if ($debug) {
echo "<!-- Cache system by Benjamin Adams. Page generated in " . round($time, 5) . " seconds. -->"; echo "<!-- Cache system by Benjamin Adams. Page generated in " . round($time, 5) . " seconds. -->";
if ($debug) { echo "<!-- Site was cached = " . $cache . " -->";
echo "<!-- wp-redis-cache-seconds = " . $seconds_cache_redis . " -->"; echo "<!-- wp-redis-cache-seconds = " . $seconds_cache_redis . " -->";
echo "<!-- wp-redis-cache-secret = " . $secret_string . "-->"; echo "<!-- wp-redis-cache-secret = " . $secret_string . "-->";
echo "<!-- wp-redis-cache-ip = " . $ip_of_your_website . "-->"; echo "<!-- wp-redis-cache-ip = " . $ip_of_your_website . "-->";
echo "<!-- wp-redis-cache-unlimited = " . $unlimited . "-->"; echo "<!-- wp-redis-cache-unlimited = " . $unlimited . "-->";
echo "<!-- wp-redis-cache-debug = " . $debug . "-->"; echo "<!-- wp-redis-cache-debug = " . $debug . "-->";
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment