|
eZ Publish
[4.2]
|
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 | |
| static | executeActions () |
Public Attributes | |
| $AlwaysUpdate | |
| An array with URLs that is to always be updated. | |
| $CachedURLArray | |
| Array of URLs to cache. | |
| $HostName | |
| The name of the host to fetch HTML data from. | |
| $MaxCacheDepth | |
| The maximum depth of URLs that will be cached. | |
| $StaticStorage | |
| The base path for the directory where static files are placed. | |
| const | USER_AGENT = 'eZ Publish static cache generator' |
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 | |
| static | storeCachedFile ($file, $content) |
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 = new eZStaticCache(); $staticCache->generateCache();
To generate the URLs that must always be updated call generateAlwaysUpdatedCache()
Definition at line 52 of file ezstaticcache.php.
| 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.
Definition at line 451 of file ezstaticcache.php.
Referenced by storeCache().
| eZStaticCache::alwaysUpdateURLArray | ( | ) |
AlwaysUpdateArray in staticcache.ini. Definition at line 115 of file ezstaticcache.php.
| eZStaticCache::buildCacheFilename | ( | $ | staticStorageDir, |
| $ | url | ||
| ) | [private] |
| $staticStorageDir | The storage for cache files. |
| $url | The URL for the current item, e.g /news |
Definition at line 390 of file ezstaticcache.php.
Referenced by storeCache().
| eZStaticCache::cachedSiteAccesses | ( | ) |
Definition at line 97 of file ezstaticcache.php.
| eZStaticCache::cachedURLArray | ( | ) |
Definition at line 105 of file ezstaticcache.php.
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().
| $url | The URL to cache, e.g /news |
| $nodeID | The ID of the node to cache, if supplied it will also cache content/view/full/xxx. |
| $skipExisting | If true it will not unlink existing cache files. |
Definition at line 276 of file ezstaticcache.php.
Referenced by generateCache(), and generateNodeListCache().
| static eZStaticCache::executeActions | ( | ) | [static] |
This function goes over the list of recorded actions and excecutes them.
Definition at line 463 of file ezstaticcache.php.
| eZStaticCache::eZStaticCache | ( | ) |
Initialises the static cache object with settings from staticcache.ini.
Definition at line 59 of file ezstaticcache.php.
| eZStaticCache::generateAlwaysUpdatedCache | ( | $ | quiet = false, |
| $ | cli = false, |
||
| $ | delay = true |
||
| ) |
Generates the caches for all URLs that must always be generated.
Definition at line 125 of file ezstaticcache.php.
| eZStaticCache::generateCache | ( | $ | force = false, |
| $ | quiet = false, |
||
| $ | cli = false, |
||
| $ | delay = true |
||
| ) |
Generates the static cache from the configured INI settings.
| $force | If true then it will create all static caches even if it is not outdated. |
| $quiet | If true then the function will not output anything. |
| $cli | The eZCLI object or false if no output can be done. |
Definition at line 186 of file ezstaticcache.php.
| eZStaticCache::generateNodeListCache | ( | $ | nodeList | ) |
Generates caches for all the urls of nodes in $nodeList. $nodeList is an array with node entries, each entry is either the node ID or an associative array. The associative array must have on of these entries:
Definition at line 147 of file ezstaticcache.php.
| eZStaticCache::hostName | ( | ) |
Definition at line 73 of file ezstaticcache.php.
| eZStaticCache::maxCacheDepth | ( | ) |
Definition at line 89 of file ezstaticcache.php.
| 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.
| $url | The URL for the curren item, e.g /news |
Definition at line 438 of file ezstaticcache.php.
| eZStaticCache::storageDirectory | ( | ) |
Definition at line 81 of file ezstaticcache.php.
| 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.
| $url | The URL to cache, e.g /news |
| $hostname | The name of the host which serves web pages dynamically, see hostName(). |
| $staticStorageDir | The base directory for storing cache files, see storageDirectory(). |
| $alternativeStaticLocations | An array with additional URLs that should also be cached. |
| $skipUnlink | If true it will not unlink existing cache files. |
Definition at line 325 of file ezstaticcache.php.
Referenced by cacheURL(), and generateAlwaysUpdatedCache().
| static eZStaticCache::storeCachedFile | ( | $ | file, |
| $ | content | ||
| ) | [static, private] |
Stores the cache file $file with contents $content. Takes care of setting proper permissions on the new file.
Definition at line 403 of file ezstaticcache.php.
Referenced by storeCache().
| eZStaticCache::$AlwaysUpdate |
An array with URLs that is to always be updated.
Definition at line 531 of file ezstaticcache.php.
| eZStaticCache::$CachedURLArray |
Array of URLs to cache.
Definition at line 529 of file ezstaticcache.php.
| eZStaticCache::$HostName |
The name of the host to fetch HTML data from.
Definition at line 523 of file ezstaticcache.php.
| eZStaticCache::$MaxCacheDepth |
The maximum depth of URLs that will be cached.
Definition at line 527 of file ezstaticcache.php.
| eZStaticCache::$StaticStorage |
The base path for the directory where static files are placed.
Definition at line 525 of file ezstaticcache.php.
| const eZStaticCache::USER_AGENT = 'eZ Publish static cache generator' |
Definition at line 54 of file ezstaticcache.php.
Referenced by storeCache().