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. | |
| $CachedURLArray | |
| Array of URLs to cache. | |
| $HostName | |
| $MaxCacheDepth | |
| The maximum depth of URLs that will be cached. | |
| $StaticStorage | |
| The base path for the directory where static files are placed. | |
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 57 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 409 of file ezstaticcache.php.
Referenced by storeCache().
| eZStaticCache::alwaysUpdateURLArray | ( | ) |
AlwaysUpdateArray in staticcache.ini. Definition at line 118 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 350 of file ezstaticcache.php.
Referenced by storeCache().
| eZStaticCache::cachedSiteAccesses | ( | ) |
Definition at line 100 of file ezstaticcache.php.
| eZStaticCache::cachedURLArray | ( | ) |
Definition at line 108 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 234 of file ezstaticcache.php.
Referenced by generateCache(), and generateNodeListCache().
| eZStaticCache::executeActions | ( | ) | [static] |
This function goes over the list of recorded actions and excecutes them.
Definition at line 421 of file ezstaticcache.php.
| eZStaticCache::eZStaticCache | ( | ) |
Initialises the static cache object with settings from staticcache.ini.
Definition at line 62 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 128 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 173 of file ezstaticcache.php.
| eZStaticCache::generateNodeListCache | ( | $ | nodeList | ) |
Definition at line 143 of file ezstaticcache.php.
| eZStaticCache::hostName | ( | ) |
Definition at line 76 of file ezstaticcache.php.
| eZStaticCache::maxCacheDepth | ( | ) |
Definition at line 92 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 396 of file ezstaticcache.php.
| eZStaticCache::storageDirectory | ( | ) |
Definition at line 84 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 281 of file ezstaticcache.php.
Referenced by cacheURL(), and generateAlwaysUpdatedCache().
| 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 363 of file ezstaticcache.php.
Referenced by executeActions(), and storeCache().
eZStaticCache::$AlwaysUpdate [private] |
An array with URLs that is to always be updated.
Definition at line 471 of file ezstaticcache.php.
eZStaticCache::$CachedURLArray [private] |
Array of URLs to cache.
Definition at line 469 of file ezstaticcache.php.
eZStaticCache::$HostName [private] |
The name of the host to fetch HTML data from.
Definition at line 463 of file ezstaticcache.php.
eZStaticCache::$MaxCacheDepth [private] |
The maximum depth of URLs that will be cached.
Definition at line 467 of file ezstaticcache.php.
eZStaticCache::$StaticStorage [private] |
The base path for the directory where static files are placed.
Definition at line 465 of file ezstaticcache.php.
1.6.3