From b4df5339e186b400d048ed1b8cd7bc1bc4014122 Mon Sep 17 00:00:00 2001 From: Erick Hitter <ehitter@gmail.com> Date: Thu, 27 Feb 2014 22:30:17 -0800 Subject: [PATCH] Better variable names --- index-redis-page-cache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index-redis-page-cache.php b/index-redis-page-cache.php index 8c04bc0..0c4438e 100644 --- a/index-redis-page-cache.php +++ b/index-redis-page-cache.php @@ -311,12 +311,12 @@ try { $load_wp = true; // Relevant details on the current request - $is_post = ( ! empty( $GLOBALS['HTTP_RAW_POST_DATA'] ) || ! empty( $_POST ) ); - $logged_in = (bool) preg_match( "#(wordpress_(logged|sec)|comment_author)#", var_export( $_COOKIE, true ) ); + $is_post_request = ( ! empty( $GLOBALS['HTTP_RAW_POST_DATA'] ) || ! empty( $_POST ) ); + $is_cache_exempt = (bool) preg_match( "#(wordpress_(logged|sec)|comment_author)#", var_export( $_COOKIE, true ) ); if ( $redis_page_cache_config['debug'] ) { - $redis_page_cache_config['debug_messages'] .= "<!-- POST request: " . ( $is_post ? 'yes' : 'no' ) . " -->\n"; - $redis_page_cache_config['debug_messages'] .= "<!-- Logged in: " . ( $logged_in ? 'yes' : 'no' ) . " -->\n"; + $redis_page_cache_config['debug_messages'] .= "<!-- POST request: " . ( $is_post_request ? 'yes' : 'no' ) . " -->\n"; + $redis_page_cache_config['debug_messages'] .= "<!-- Cache exexmpt (logged in, commenter): " . ( $is_cache_exempt ? 'yes' : 'no' ) . " -->\n"; } // Refresh request, deletes cache: either manual refresh cache by adding ?refresh=secret_string after the URL or somebody posting a comment @@ -327,7 +327,7 @@ try { $redis->del( $redis_page_cache_config['redis_key'] ); // This page is cached, the user isn't logged in, and it isn't a POST request, so let's use the cache - } elseif ( ! $is_post && ! $logged_in && $redis->exists( $redis_page_cache_config['redis_key'] ) ) { + } elseif ( ! $is_post_request && ! $is_cache_exempt && $redis->exists( $redis_page_cache_config['redis_key'] ) ) { if ( $redis_page_cache_config['debug'] ) { $redis_page_cache_config['debug_messages'] .= "<!-- Serving page from cache -->\n"; } @@ -376,7 +376,7 @@ try { } // If user isn't logged in and this isn't a post request, render the requested page and cache if appropriate. - if ( ! $is_post && ! $logged_in ) { + if ( ! $is_post_request && ! $is_cache_exempt ) { if ( $redis_page_cache_config['debug'] ) { $redis_page_cache_config['debug_messages'] .= "<!-- Adding page to cache -->\n"; } -- GitLab