eZPublish  3.9
eZStaticCache Class Reference

Manages the static cache system. More...

Public Member Functions

 alwaysUpdateURLArray ()
 
 cachedSiteAccesses ()
 
 cachedURLArray ()
 
 eZStaticCache ()
 
 generateAlwaysUpdatedCache ($quiet=false, $cli=false, $delay=true)
 
 generateCache ($force=false, $quiet=false, $cli=false, $delay=true)
 
 generateNodeListCache ($nodeList)
 
 hostName ()
 
 maxCacheDepth ()
 
 removeURL ($url)
 
 storageDirectory ()
 

Static Public Member Functions

 executeActions ()
 

Private Member Functions

 addAction ($action, $parameters)
 
 buildCacheFilename ($staticStorageDir, $url)
 
 cacheURL ($url, $nodeID=false, $skipExisting=false, $delay=true)
 
 storeCache ($url, $hostname, $staticStorageDir, $alternativeStaticLocations=array(), $skipUnlink=false, $delay=true)
 

Static Private Member Functions

 storeCachedFile ($file, $content)
 

Private Attributes

 $AlwaysUpdate
 An array with URLs that is to always be updated. More...
 
 $CachedURLArray
 Array of URLs to cache. More...
 
 $HostName
 The name of the host to fetch HTML data from. More...
 
 $MaxCacheDepth
 The maximum depth of URLs that will be cached. More...
 
 $StaticStorage
 The base path for the directory where static files are placed. More...
 

Detailed Description

Manages the static cache system.

This class can be used to generate static cache files usable by the static cache system.

Generating static cache is done by instatiating the class and then calling generateCache(). For example:

$staticCache->generateCache();

To generate the URLs that must always be updated call generateAlwaysUpdatedCache()

Member Function Documentation

eZStaticCache::addAction (   $action,
  $parameters 
)
private

This function adds an action to the list that is used at the end of the request to remove and regenerate static cache files.

Referenced by storeCache().

eZStaticCache::alwaysUpdateURLArray ( )
Returns
An array with URLs that is to always be updated.
Note
These URLs are configured with AlwaysUpdateArray in staticcache.ini.
See Also
generateAlwaysUpdatedCache()
eZStaticCache::buildCacheFilename (   $staticStorageDir,
  $url 
)
private
Parameters
$staticStorageDirThe storage for cache files.
$urlThe URL for the current item, e.g /news
Returns
The full path to the cache file (index.html) based on the input parameters.

Referenced by storeCache().

eZStaticCache::cachedSiteAccesses ( )
Returns
An array with site-access names that should be cached.
eZStaticCache::cachedURLArray ( )
Returns
An array with URLs that is to be cached statically, the URLs may contain wildcards.

Referenced by generateCache().

eZStaticCache::cacheURL (   $url,
  $nodeID = false,
  $skipExisting = false,
  $delay = true 
)
private

Generates the caches for the url $url using the currently configured hostName() and storageDirectory().

Parameters
$urlThe URL to cache, e.g /news
$nodeIDThe ID of the node to cache, if supplied it will also cache content/view/full/xxx.
$skipExistingIf true it will not unlink existing cache files.

Referenced by generateCache(), and generateNodeListCache().

eZStaticCache::executeActions ( )
static

This function goes over the list of recorded actions and excecutes them.

eZStaticCache::eZStaticCache ( )

Initialises the static cache object with settings from staticcache.ini.

eZStaticCache::generateAlwaysUpdatedCache (   $quiet = false,
  $cli = false,
  $delay = true 
)

Generates the caches for all URLs that must always be generated.

See Also
alwaysUpdateURLArray().
eZStaticCache::generateCache (   $force = false,
  $quiet = false,
  $cli = false,
  $delay = true 
)

Generates the static cache from the configured INI settings.

Parameters
$forceIf true then it will create all static caches even if it is not outdated.
$quietIf true then the function will not output anything.
$cliThe eZCLI object or false if no output can be done.
eZStaticCache::generateNodeListCache (   $nodeList)
eZStaticCache::hostName ( )
Returns
The currently configured host-name.
eZStaticCache::maxCacheDepth ( )
Returns
The maximum depth in the url which will be cached.
eZStaticCache::removeURL (   $url)

Removes the static cache file (index.html) and its directory if it exists. The directory path is based upon the URL $url and the configured static storage dir.

Parameters
$urlThe URL for the curren item, e.g /news
eZStaticCache::storageDirectory ( )
Returns
The currently configured storage directory for the static cache.
eZStaticCache::storeCache (   $url,
  $hostname,
  $staticStorageDir,
  $alternativeStaticLocations = array(),
  $skipUnlink = false,
  $delay = true 
)
private

Stores the static cache for $url and $hostname by fetching the web page using fopen() and storing the fetched HTML data.

Parameters
$urlThe URL to cache, e.g /news
$hostnameThe name of the host which serves web pages dynamically, see hostName().
$staticStorageDirThe base directory for storing cache files, see storageDirectory().
$alternativeStaticLocationsAn array with additional URLs that should also be cached.
$skipUnlinkIf true it will not unlink existing cache files.

Referenced by cacheURL(), and generateAlwaysUpdatedCache().

eZStaticCache::storeCachedFile (   $file,
  $content 
)
staticprivate

Stores the cache file $file with contents $content. Takes care of setting proper permissions on the new file.

Referenced by executeActions(), and storeCache().

Member Data Documentation

eZStaticCache::$AlwaysUpdate
private

An array with URLs that is to always be updated.

Referenced by alwaysUpdateURLArray().

eZStaticCache::$CachedURLArray
private

Array of URLs to cache.

Referenced by cachedURLArray().

eZStaticCache::$HostName
private

The name of the host to fetch HTML data from.

Referenced by cacheURL(), generateAlwaysUpdatedCache(), and hostName().

eZStaticCache::$MaxCacheDepth
private

The maximum depth of URLs that will be cached.

Referenced by maxCacheDepth().

eZStaticCache::$StaticStorage
private

The base path for the directory where static files are placed.


The documentation for this class was generated from the following file: