| 1 |
<?php |
| 2 |
/* |
| 3 |
* ezCache Advanced Cache |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
die( 'NO direct access!' ); |
| 8 |
} |
| 9 |
|
| 10 |
// require utilities functions from the plugin |
| 11 |
/** @noinspection PhpIncludeInspection */ |
| 12 |
include_once __DIR__ . '/plugins/ezcache/vendor/autoload.php'; |
| 13 |
|
| 14 |
if ( class_exists( '\Upress\EzCache\Cache' ) && ! function_exists( 'wp_cache_postload' ) ) { |
| 15 |
global $ezcache; |
| 16 |
|
| 17 |
/** @noinspection PhpFullyQualifiedNameUsageInspection */ |
| 18 |
$ezcache = \Upress\EzCache\Cache::instance(); |
| 19 |
$ezcache->maybe_serve_cached_data(); |
| 20 |
|
| 21 |
// this needs to run before wp_cache_postload but after checking a cache file exists |
| 22 |
$ezcache->do_frontend_optimizations(); |
| 23 |
|
| 24 |
/** |
| 25 |
* Start saving the cache file |
| 26 |
* This function is called at wp-settings.php when WP_CACHE is true in wp-config.php |
| 27 |
*/ |
| 28 |
function wp_cache_postload() { |
| 29 |
global $ezcache; |
| 30 |
|
| 31 |
$ezcache->maybe_write_cache_file(); |
| 32 |
} |
| 33 |
} |
| 34 |
|