CacheHelper helps create full page view caching.
When using CacheHelper you don't call any of its methods, they are all automatically called by View, and use the $cacheAction settings set in the controller.
CacheHelper This class will be removed in 3.0. You should use a separate response cache like Varnish instead.
$_counter protected integer$_match protected arrayArray of string that are replace with there var replace above. The strings are any content inside <!--nocache--><!--/nocache--> and includes the tags in views
$_replace protected arrayArray of strings replaced in cached views. The strings are found between <!--nocache--><!--/nocache--> in views
Parse a file + output. Matches nocache tags between the current output and the current file stores a reference of the file, so the generated can be swapped back with the file contents when writing the cache file.
Munges the output from a view with cache tags, and numbers the sections. This helps solve issues with empty/duplicate content.
Strip cake:nocache tags from a string. Since View::render() only removes un-numbered nocache tags, remove all the numbered ones. This is the complement to _replaceSection.
_enabled( )
Is CacheHelper enabled? should files + output be parsed.
_parseContent( string $file , string $out )
Parse a file + output. Matches nocache tags between the current output and the current file stores a reference of the file, so the generated can be swapped back with the file contents when writing the cache file.
$file $out _parseFile( string $file , string $cache )
Parse file searching for no cache tags
$file $cache _parseOutput( string $cache )
Parse the output and replace cache tags
$cache _replaceSection( )
Munges the output from a view with cache tags, and numbers the sections. This helps solve issues with empty/duplicate content.
_stripTags( string $content )
Strip cake:nocache tags from a string. Since View::render() only removes un-numbered nocache tags, remove all the numbered ones. This is the complement to _replaceSection.
$content _writeFile( string $content , string $timestamp , boolean|null $useCallbacks false )
Write a cached version of the file
$content $timestamp $useCallbacks optional false Whether to include statements in cached file which run callbacks, otherwise null.
afterLayout( string $layoutFile )
Parses the layout file and stores content for cache file building.
$layoutFile afterRenderFile( string $viewFile , string $output )
Parses the view file and stores content for cache file building.
$viewFile $output cache( string $file , string $out )
Main method used to cache a view
$file $out protected array
Array of string that are replace with there var replace above. The strings are any content inside <!--nocache--><!--/nocache--> and includes the tags in views
array()
protected array
Array of strings replaced in cached views. The strings are found between <!--nocache--><!--/nocache--> in views
array()
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-CacheHelper.html