erLhcoreClassCacheSystem

With help of this class you can make cache blocks with different keys. It's usual for menu and static information that do not change or change very rarely. Cache blocks expires every one hour.

Example: <?
$CacheID = array(isset($Result['CategoryID']) ? $Result['CategoryID'] : 0);

if (($CacheContent = erLhcoreClassCacheSystem::getCache('menu_blocks',$CacheID)) === false)
{
erLhcoreClassCacheSystem::startCacheBlock();

$Categorys = erLhcoreClassCategorys::getCategorysByParent(0);
$CategorysCount = count($Categorys)-1;
foreach ($Categorys as $key => $category) : ?>
<?
$classItem = array();
if (isset($Result['CategoryID']) && $Result['CategoryID'] == $category['id']) $classItem[] = 'selected';
if ($CategorysCount == $key) $classItem[] = 'lastli';
?>
<li <?=(count($classItem) > 0) ? 'class="'.implode(' ',$classItem).'"' : ''?>><a href="<?=erLhcoreClassDesign::baseurl('skelbimai/sritis/'.$category['id'])?>"><?=$category['name']?></a></li>
<? endforeach;
unset($Categorys);
unset($CategorysCount);

echo erLhcoreClassCacheSystem::endCacheBlock('menu_blocks',$CacheID);
} else {
echo $CacheContent;
}
?>