Class

eZStaticCache

class eZStaticCache implements ezpStaticCache

The eZStaticCache class 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 instantiating the class and then calling generateCache(). For example:

$staticCache = new eZStaticCache(); $staticCache->generateCache();

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

Constants

USER_AGENT

User-Agent string

Methods

__construct()

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

string hostName()

Getter method for {@link eZStaticCache::$hostName}

string storageDirectory()

Getter method for {@link eZStaticCache::$staticStorageDir}

int maxCacheDepth()

Getter method for {@link eZStaticCache::$maxCacheDepth}

array cachedSiteAccesses()

Getter method for {@link eZStaticCache::$cachedSiteAccesses}

array cachedURLArray()

Getter method for {@link eZStaticCache::$cachedURLArray}

array alwaysUpdateURLArray()

Getter method for {@link eZStaticCache::$alwaysUpdate}

generateAlwaysUpdatedCache(bool $quiet = false, eZCLI|false $cli = false, bool $delay = true)

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

bool generateNodeListCache(array $nodeList)

Generates caches for all the urls of nodes in $nodeList.

generateCache(bool $force = false, bool $quiet = false, eZCLI|false $cli = false, bool $delay = true)

Generates the static cache from the configured INI settings.

bool cacheURL($url, $nodeID = false, $skipExisting = false, $delay = true)

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

removeURL(string $url)

Removes the static cache file (index.html) and its directory if it exists.

Details

at line 84
public __construct()

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

at line 101
public string hostName()

Getter method for {@link eZStaticCache::$hostName}

Return Value

string The currently configured host-name.

at line 111
public string storageDirectory()

Getter method for {@link eZStaticCache::$staticStorageDir}

Return Value

string The currently configured storage directory for the static cache.

at line 121
public int maxCacheDepth()

Getter method for {@link eZStaticCache::$maxCacheDepth}

Return Value

int The maximum depth in the url which will be cached.

at line 131
public array cachedSiteAccesses()

Getter method for {@link eZStaticCache::$cachedSiteAccesses}

Return Value

array An array with site-access names that should be cached.

at line 141
public array cachedURLArray()

Getter method for {@link eZStaticCache::$cachedURLArray}

Return Value

array An array with URLs that is to be cached statically, the URLs may contain wildcards.

at line 154
public array alwaysUpdateURLArray()

Getter method for {@link eZStaticCache::$alwaysUpdate}

These URLs are configured with AlwaysUpdateArray in staticcache.ini.

Return Value

array An array with URLs that is to always be updated.

See also

eZStaticCache::generateAlwaysUpdatedCache()

at line 166
public generateAlwaysUpdatedCache(bool $quiet = false, eZCLI|false $cli = false, bool $delay = true)

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

Parameters

bool $quiet If true then the function will not output anything.
eZCLI|false $cli The eZCLI object or false if no output can be done.
bool $delay

at line 187
public bool generateNodeListCache(array $nodeList)

Generates caches for all the urls of nodes in $nodeList.

The associative array must have on of these entries: - nodeid - ID of the node - pathidentificationstring - The pathidentificationstring from the node table, is used to fetch the node ID if nodeid is missing.

Parameters

array $nodeList An array with node entries, each entry is either the node ID or an associative array.

Return Value

bool True if the operation succeed.

at line 227
public generateCache(bool $force = false, bool $quiet = false, eZCLI|false $cli = false, bool $delay = true)

Generates the static cache from the configured INI settings.

Parameters

bool $force If true then it will create all static caches even if it is not outdated.
bool $quiet If true then the function will not output anything.
eZCLI|false $cli The eZCLI object or false if no output can be done.
bool $delay

at line 317
public bool cacheURL($url, $nodeID = false, $skipExisting = false, $delay = true)

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

Parameters

$url
$nodeID
$skipExisting
$delay

Return Value

bool

at line 553
public removeURL(string $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

string $url The URL for the current item, e.g /news