コード例 #1
0
                 $html_of_page = ob_get_clean();
                 // ob_get_clean also closes the OB
                 echo $html_of_page;
                 if (!is_numeric($seconds_cache_redis)) {
                     $seconds_cache_redis = 86400;
                 }
                 if ($compress) {
                     $html_of_page = gzcompress($html_of_page, 1);
                 }
                 // When a page displays after an "HTTP 404: Not Found" error occurs, do not cache
                 // When the search was used, do not cache
                 if (!is_404() and !is_search()) {
                     if ($unlimited) {
                         $redis->set($redis_key, $html_of_page);
                     } else {
                         $redis->setex($redis_key, $seconds_cache_redis, $html_of_page);
                     }
                 }
             } else {
                 //either the user is logged in, or is posting a comment, show them uncached
                 require $wp_blog_header_path;
             }
         } else {
             if ($_SERVER['REMOTE_ADDR'] != $websiteIp && strstr($current_url, 'preview=true') == true) {
                 require $wp_blog_header_path;
             }
         }
     }
 }
 // else {   // This is what your server should get if no cache exists  //deprecated, as the ob_start() is cleaner
 //require( $wp_blog_header_path );