|
eZ Publish
[trunk]
|
Cache block. More...
Static Public Member Functions | |
| static | cachePath ($keyString, $nodeID=false) |
| static | calculateSubtreeCacheDir ($nodeID, $cacheFilename) |
| static | decodeNodeID ($subtreeExpiryParameter) |
| static | getSubtreeModification ($nodeID) |
| static | handle ($cachePath, $nodeID, $ttl, $useGlobalExpiry=true) |
| static | keyString ($keys) |
| static | placementString ($functionPlacement) |
| static | retrieve ($keys, $subtreeExpiry, $ttl, $useGlobalExpiry=true) |
| static | retrieveContent ($fname, $mtime) |
| static | subtreeCacheBaseSubDir () |
| static | subtreeCacheSubDir ($subtreeExpiryParameter, $cacheFilename) |
| static | subtreeCacheSubDirForNode ($nodeID) |
| static | templateBlockCacheDir () |
Cache block.
Definition at line 17 of file eztemplatecacheblock.php.
| static eZTemplateCacheBlock::cachePath | ( | $ | keyString, |
| $ | nodeID = false |
||
| ) | [static] |
Calculates the cache path based on the key string $keyString and $nodeID.
See subtreeCacheSubDir() for more details on the $nodeID parameter.
Definition at line 142 of file eztemplatecacheblock.php.
Referenced by eZTemplateCacheFunction\processCached(), retrieve(), and eZTemplateCacheFunction\templateNodeTransformation().
| static eZTemplateCacheBlock::calculateSubtreeCacheDir | ( | $ | nodeID, |
| $ | cacheFilename | ||
| ) | [static] |
Returns path of the directory where 'subtree_expiry' caches are stored.
See decodeNodeID() for details on the $subtreeExpiryParameter parameter.
Definition at line 234 of file eztemplatecacheblock.php.
Referenced by cachePath(), and subtreeCacheSubDir().
| static eZTemplateCacheBlock::decodeNodeID | ( | $ | subtreeExpiryParameter | ) | [static] |
Figures out the node ID for the $subtreeExpiryParameter.
The parameter $subtreeExpiryParameter is expiry value is usually taken from the template operator and can be one of:
Definition at line 179 of file eztemplatecacheblock.php.
Referenced by retrieve(), and subtreeCacheSubDir().
| static eZTemplateCacheBlock::getSubtreeModification | ( | $ | nodeID | ) | [static] |
Figures out the modification time for the subtree by looking up the database using $nodeID. If $nodeID is set to false no lookup is done and it will return -1.
Definition at line 95 of file eztemplatecacheblock.php.
Referenced by handle().
| static eZTemplateCacheBlock::handle | ( | $ | cachePath, |
| $ | nodeID, | ||
| $ | ttl, | ||
| $ | useGlobalExpiry = true |
||
| ) | [static] |
Helper function for the compiled code, similar to retrieve() but requires the $cachePath to be calculated up front.
Definition at line 61 of file eztemplatecacheblock.php.
Referenced by retrieve().
| static eZTemplateCacheBlock::keyString | ( | $ | keys | ) | [static] |
Calculates the key string from the key values $keys.
Note: Arrays are traversed recursively.
Definition at line 131 of file eztemplatecacheblock.php.
Referenced by eZTemplateCacheFunction\processCached(), retrieve(), and eZTemplateCacheFunction\templateNodeTransformation().
| static eZTemplateCacheBlock::placementString | ( | $ | functionPlacement | ) | [static] |
Calculates the key entry for the function placement array $functionPlacement and returns it.
Definition at line 115 of file eztemplatecacheblock.php.
Referenced by eZTemplateCacheFunction\processCachedPreprocess(), and eZTemplateCacheFunction\templateNodeTransformation().
| static eZTemplateCacheBlock::retrieve | ( | $ | keys, |
| $ | subtreeExpiry, | ||
| $ | ttl, | ||
| $ | useGlobalExpiry = true |
||
| ) | [static] |
Helper function for retrieving a cache-block entry which can be used by any custom code.
| $keys | Array or string which is used for key. To ensure uniqueness prefix or add an entry which is unique to your code. |
| $subtreeExpiry | The subtree expiry value, use null to disable or a string. See subtreeCacheSubDir for more details. |
| $ttl | Amount of seconds the cache should live, use null, 0 or -1 to disable TTL. |
| $useGlobalExpiry | Boolean which controls if the global content expiry value should be used or not. |
Returns an array with the file handler objects as the first entry and the content data as the second. If the content could not be retrieved the content contains the object eZClusterFileFailure.
Example of usage:
list($handler, $data) = eZTemplateCacheBlock::retrieve( array( 'my_cool_key', $id, ), $nodeID, 60 ); // lives 60 seconds if ( !$data instanceof eZClusterFileFailure ) { echo $data; } else { // ... generate the data $data = '...'; $handler->storeCache( array( 'scope' => 'template-block', 'binarydata' => $data ) ); }
Note: Because of the cluster code the storeCache() call must occur to ensure stability.
Definition at line 50 of file eztemplatecacheblock.php.
| static eZTemplateCacheBlock::retrieveContent | ( | $ | fname, |
| $ | mtime | ||
| ) | [static] |
Callback function to get the contents of the specified filename.
| $fname | Name of file |
| $mtime | Modified time of file. |
Definition at line 300 of file eztemplatecacheblock.php.
| static eZTemplateCacheBlock::subtreeCacheBaseSubDir | ( | ) | [static] |
Returns base directory where 'subtree_expiry' caches are stored.
Definition at line 288 of file eztemplatecacheblock.php.
Referenced by subtreeCacheSubDirForNode().
| static eZTemplateCacheBlock::subtreeCacheSubDir | ( | $ | subtreeExpiryParameter, |
| $ | cacheFilename | ||
| ) | [static] |
Returns path of the directory where 'subtree_expiry' caches are stored.
See decodeNodeID() for details on the $subtreeExpiryParameter parameter.
Definition at line 250 of file eztemplatecacheblock.php.
| static eZTemplateCacheBlock::subtreeCacheSubDirForNode | ( | $ | nodeID | ) | [static] |
Builds and returns path from $nodeID, e.g. if $nodeID = 23 then path = subtree/2/3
Definition at line 260 of file eztemplatecacheblock.php.
Referenced by calculateSubtreeCacheDir().
| static eZTemplateCacheBlock::templateBlockCacheDir | ( | ) | [static] |
Returns base directory where template block caches are stored.
Definition at line 164 of file eztemplatecacheblock.php.
Referenced by cachePath(), eZDFSFileHandlerMySQLBackend\nameTrunk(), eZDFSFileHandlerMySQLiBackend\nameTrunk(), eZDBFileHandlerMysqlBackend\nameTrunk(), and eZDBFileHandlerMysqliBackend\nameTrunk().