CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CacheHelper
  • FormHelper
  • HtmlHelper
  • JqueryEngineHelper
  • JsBaseEngineHelper
  • JsHelper
  • MootoolsEngineHelper
  • NumberHelper
  • PaginatorHelper
  • PrototypeEngineHelper
  • RssHelper
  • SessionHelper
  • TextHelper
  • TimeHelper

Class CacheHelper

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.

AppHelper
Extended by CacheHelper
Package: Cake\View\Helper
Link: http://book.cakephp.org/2.0/en/core-libraries/helpers/cache.html
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/View/Helper/CacheHelper.php

Properties summary

  • $_counter protected
    integer
    Counter used for counting nocache section tags.
  • $_match 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

  • $_replace protected
    array

    Array of strings replaced in cached views. The strings are found between <!--nocache--><!--/nocache--> in views

Method Summary

  • _enabled() protected
    Is CacheHelper enabled? should files + output be parsed.
  • _parseContent() protected

    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.

  • _parseFile() protected
    Parse file searching for no cache tags
  • _parseOutput() protected
    Parse the output and replace cache tags
  • _replaceSection() protected

    Munges the output from a view with cache tags, and numbers the sections. This helps solve issues with empty/duplicate content.

  • _stripTags() protected

    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.

  • _writeFile() protected
    Write a cached version of the file
  • afterLayout() public
    Parses the layout file and stores content for cache file building.
  • afterRenderFile() public
    Parses the view file and stores content for cache file building.
  • cache() public
    Main method used to cache a view

Method Detail

_enabled() protected ¶

_enabled( )

Is CacheHelper enabled? should files + output be parsed.

Returns
boolean

_parseContent() protected ¶

_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.

Parameters
string $file
The filename to process.
string $out
The output for the file.
Returns
string
Updated content.

_parseFile() protected ¶

_parseFile( string $file , string $cache )

Parse file searching for no cache tags

Parameters
string $file
The filename that needs to be parsed.
string $cache
The cached content

_parseOutput() protected ¶

_parseOutput( string $cache )

Parse the output and replace cache tags

Parameters
string $cache
Output to replace content in.
Returns
string
with all replacements made to

_replaceSection() protected ¶

_replaceSection( )

Munges the output from a view with cache tags, and numbers the sections. This helps solve issues with empty/duplicate content.

Returns
string
The content with cake:nocache tags replaced.

_stripTags() protected ¶

_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.

Parameters
string $content
String to remove tags from.
Returns
string
String with tags removed.

_writeFile() protected ¶

_writeFile( string $content , string $timestamp , boolean $useCallbacks = false )

Write a cached version of the file

Parameters
string $content
view content to write to a cache file.
string $timestamp
Duration to set for cache file.
boolean $useCallbacks optional false
Returns
boolean
success of caching view.

afterLayout() public ¶

afterLayout( string $layoutFile )

Parses the layout file and stores content for cache file building.

Parameters
string $layoutFile

afterRenderFile() public ¶

afterRenderFile( string $viewFile , $output )

Parses the view file and stores content for cache file building.

Parameters
string $viewFile
$output

cache() public ¶

cache( string $file , string $out )

Main method used to cache a view

Parameters
string $file
File to cache
string $out
output to cache
Returns
string
view ouput
Link
http://book.cakephp.org/2.0/en/core-libraries/helpers/cache.html

Properties detail

$_counter ¶

protected integer

Counter used for counting nocache section tags.

$_match ¶

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()

$_replace ¶

protected array

Array of strings replaced in cached views. The strings are found between <!--nocache--><!--/nocache--> in views

array()
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs