Closed byteperfect closed 3 years ago
That is intentional because Cache Enabler currently only delivers the potentially modified page contents if a cached page is being delivered, not when it's a cache miss. This only occurs if the page contents are pulled from the stored HTML and then written to the output buffer when the advanced-cache.php
drop-in is included, which means only sending the page contents Cache Enabler touches to the HTML file is required.
Sorry, but, why not immediately send the prepared html to the browser? Actually, on this stage, the cache file for the page is already created and is waiting for the next time page load / reload.
Like most caching systems we consider an object delivered with a cache miss to be from the original source that it was received from. For Cache Enabler that means delivering what was received during the output buffering unmodified. Only when it's a cache hit will we deliver what Cache Enabler has modified.
Inside
Cache_Enabler_Engine::end_buffering
function you have call ofCache_Enabler_Disk::cache_page
function which in turn callsCache_Enabler_Disk::create_cache_file
function.Cache_Enabler_Disk::create_cache_file
function modifies$page_contents
in several places, but does not path this modified value back toCache_Enabler_Engine::end_buffering
function so we have incorrect html on first time page load. This issue could be solved easily by passing page content toCache_Enabler_Disk::cache_page
andCache_Enabler_Disk::create_cache_file
by reference:Also in
Cache_Enabler_Disk::create_cache_file
we should handle compressing page contents: