Skip to content

Commit

Permalink
Allows nginx headers to be cached. Fixes Automattic#70.
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Collins committed May 5, 2016
1 parent 302a311 commit a4f6012
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions advanced-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ function vary_cache_on_function($function) {
$batcache->add_variant($function);
}

/**
* This allows nginx headers to be cached.
*/
if ( ! function_exists( 'apache_response_headers' ) ) {
function apache_response_headers() {
$arh = array();
$headers = headers_list();
foreach ( $headers as $header ) {
$header = explode( ":", $header );
$arh[ array_shift( $header ) ] = trim( implode( ":", $header ) );
}

return $arh;
}
}


class batcache {
// This is the base configuration. You can edit these variables or move them into your wp-config.php file.
var $max_age = 300; // Expire batcache items aged this many seconds (zero to disable batcache)
Expand Down

0 comments on commit a4f6012

Please sign in to comment.