From 8b7ba7524ef5cd4dc11236896a544b6071a1734c Mon Sep 17 00:00:00 2001
From: Erick Hitter <ehitter@gmail.com>
Date: Thu, 27 Feb 2014 20:27:48 -0800
Subject: [PATCH] Timer should fire before anything happens, including building
 the cache key from a URL

---
 index-redis-page-cache.php | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/index-redis-page-cache.php b/index-redis-page-cache.php
index 97892f9..4bd66c3 100644
--- a/index-redis-page-cache.php
+++ b/index-redis-page-cache.php
@@ -57,18 +57,16 @@ function redis_page_cache_exception_handler( $exception ) {
  *
  * DO NOT EDIT BELOW THIS LINE!
  */
-$redis_page_cache_config['current_url'] = redis_page_cache_get_clean_url();
-$redis_page_cache_config['redis_key']   = md5( 'v' . $redis_page_cache_config['cache_version'] . '-' . $redis_page_cache_config['current_url'] );
 
 // Start the timer so we can track the page load time
 if ( $redis_page_cache_config['debug'] || $redis_page_cache_config['stats'] ) {
 	$start = microtime();
 }
 
-/**
- * SET SEPARATE CACHES FOR BROAD DEVICE TYPES
- */
-$redis_page_cache_config['redis_key'] = redis_page_cache_set_device_key( $redis_page_cache_config['redis_key'] );
+// Make run-time additions to configuration
+$redis_page_cache_config['current_url'] = redis_page_cache_get_clean_url();
+$redis_page_cache_config['redis_key']   = md5( 'v' . $redis_page_cache_config['cache_version'] . '-' . $redis_page_cache_config['current_url'] );
+$redis_page_cache_config['redis_key']   = redis_page_cache_set_device_key( $redis_page_cache_config['redis_key'] );
 
 /**
  * UTILITY FUNCTIONS
-- 
GitLab