function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
 {
     $ini = eZINI::instance();
     $children = eZTemplateNodeTool::extractFunctionNodeChildren($node);
     if ($ini->variable('TemplateSettings', 'TemplateCache') != 'enabled') {
         return $children;
     }
     $functionPlacement = eZTemplateNodeTool::extractFunctionNodePlacement($node);
     $placementKeyString = eZTemplateCacheBlock::placementString($functionPlacement);
     $newNodes = array();
     $ignoreContentExpiry = false;
     if (isset($parameters['expiry'])) {
         if (eZTemplateNodeTool::isConstantElement($parameters['expiry'])) {
             $expiryValue = eZTemplateNodeTool::elementConstantValue($parameters['expiry']);
             $ttlCode = $expiryValue > 0 ? eZPHPCreator::variableText($expiryValue, 0, 0, false) : 'null';
         } else {
             $newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameters['expiry'], false, array(), 'localExpiry');
             $ttlCode = "( \$localExpiry > 0 ? \$localExpiry : null )";
         }
     } else {
         $ttlCode = eZPHPCreator::variableText(self::DEFAULT_TTL, 0, 0, false);
     }
     if (isset($parameters['ignore_content_expiry'])) {
         $ignoreContentExpiry = eZTemplateNodeTool::elementConstantValue($parameters['ignore_content_expiry']);
     }
     $keysData = false;
     $hasKeys = false;
     $subtreeExpiryData = null;
     $subtreeValue = null;
     if (isset($parameters['keys'])) {
         $keysData = $parameters['keys'];
         $hasKeys = true;
     }
     if (isset($parameters['subtree_expiry'])) {
         $subtreeExpiryData = $parameters['subtree_expiry'];
         if (!eZTemplateNodeTool::isConstantElement($subtreeExpiryData)) {
             $hasKeys = true;
         } else {
             $subtreeValue = eZTemplateNodeTool::elementConstantValue($subtreeExpiryData);
         }
         $ignoreContentExpiry = true;
     }
     $accessName = false;
     if (isset($GLOBALS['eZCurrentAccess']['name'])) {
         $accessName = $GLOBALS['eZCurrentAccess']['name'];
     }
     if ($hasKeys) {
         $placementKeyStringText = eZPHPCreator::variableText($placementKeyString, 0, 0, false);
         $accessNameText = eZPHPCreator::variableText($accessName, 0, 0, false);
         $newNodes[] = eZTemplateNodeTool::createVariableNode(false, $keysData, false, array(), 'cacheKeys');
         $newNodes[] = eZTemplateNodeTool::createVariableNode(false, $subtreeExpiryData, false, array(), 'subtreeExpiry');
         $code = "\$cacheKeys = array( \$cacheKeys, {$placementKeyStringText}, {$accessNameText} );\n";
         $cachePathText = "\$cachePath";
     } else {
         $nodeID = $subtreeValue ? eZTemplateCacheBlock::decodeNodeID($subtreeValue) : false;
         $cachePath = eZTemplateCacheBlock::cachePath(eZTemplateCacheBlock::keyString(array($placementKeyString, $accessName)), $nodeID);
         $code = "";
         $cachePathText = eZPHPCreator::variableText($cachePath, 0, 0, false);
     }
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode($code);
     $code = '';
     $codePlacementHash = md5($placementKeyString);
     if ($hasKeys) {
         $code .= "list(\$cacheHandler_{$codePlacementHash}, \$contentData) =\n  eZTemplateCacheBlock::retrieve( \$cacheKeys, \$subtreeExpiry, {$ttlCode}, " . ($ignoreContentExpiry ? "false" : "true") . " );\n";
     } else {
         $nodeIDText = var_export($nodeID, true);
         $code .= "list(\$cacheHandler_{$codePlacementHash}, \$contentData) =\n  eZTemplateCacheBlock::handle( {$cachePathText}, {$nodeIDText}, {$ttlCode}, " . ($ignoreContentExpiry ? "false" : "true") . " );\n";
     }
     $code .= "if ( !( \$contentData instanceof eZClusterFileFailure ) )\n" . "{\n";
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode($code, array('spacing' => 0));
     $newNodes[] = eZTemplateNodeTool::createWriteToOutputVariableNode('contentData', array('spacing' => 4));
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode("    unset( \$contentData );\n" . "}\n" . "else\n" . "{\n" . "    unset( \$contentData );");
     $newNodes[] = eZTemplateNodeTool::createOutputVariableIncreaseNode(array('spacing' => 4));
     $newNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode(4);
     $newNodes = array_merge($newNodes, $children);
     $newNodes[] = eZTemplateNodeTool::createSpacingDecreaseNode(4);
     $newNodes[] = eZTemplateNodeTool::createAssignFromOutputVariableNode('cachedText', array('spacing' => 4));
     $code = "\$cacheHandler_{$codePlacementHash}->storeCache( array( 'scope' => 'template-block', 'binarydata' => \$cachedText ) );\n";
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode($code, array('spacing' => 4));
     $newNodes[] = eZTemplateNodeTool::createOutputVariableDecreaseNode(array('spacing' => 4));
     $newNodes[] = eZTemplateNodeTool::createWriteToOutputVariableNode('cachedText', array('spacing' => 4));
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode("    unset( \$cachedText, \$cacheHandler_{$codePlacementHash} );\n}\n");
     return $newNodes;
 }