Last active
June 6, 2018 01:50
-
-
Save gartes/7e163f2d33a7e58d11f58f3076dd9c94 to your computer and use it in GitHub Desktop.
JCache кеш
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( !( $html = $JСache->get( 'action-footer' , 'mododuls' ) ) ) { | |
jimport('ukcpu.document.document'); | |
jimport('ukcpu.admin.control'); | |
$uDoc = ukcpuDocument::getDocument(); | |
#$module = JModuleHelper::getModules('action-footer'); | |
#$attribs['style'] = 'raw'; | |
#$html = JModuleHelper::renderModule($module[0], $attribs); | |
// if type html | |
// minifid - html | |
$html = $uDoc -> minHtml ( $html ) ; | |
$JСache->store( $html , 'action-footer' , 'mododuls' ); | |
} | |
echo $html ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jimport('joomla.cache.cache'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!$this->app) | |
{ | |
$this->app = JFactory::getApplication(); | |
} | |
if (!class_exists( 'CacheModelCache' )) | |
require(JPATH_ROOT .'/administrator/components/com_cache/models/cache.php'); | |
$modelCache = new CacheModelCache(); | |
$allCleared = true ; | |
$clients = array(1, 0); | |
foreach ($clients as $client) | |
{ | |
$mCache = $modelCache->getCache($client); | |
$clientStr = JText::_($client ? 'JADMINISTRATOR' : 'JSITE') .' > '; | |
foreach ($mCache->getAll() as $cache) | |
{ | |
if ($mCache->clean($cache->group) === false) | |
{ | |
$app->enqueueMessage(JText::sprintf('Ошибка очистки кеша ', $clientStr . $cache->group), 'error'); | |
$allCleared = false; | |
} | |
} | |
} | |
if ($allCleared) | |
{ | |
$this->app->enqueueMessage(JText::_('Кеш очищен') , 'message' ); | |
} | |
else | |
{ | |
$this->app->enqueueMessage(JText::_('Кеш очищен не полностью'), 'warning'); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$options = array( | |
'cachebase' => JPATH_ROOT.DS.'cache' , // кеш папка в корне сайта | |
'lifetime' => 144000 , // (int) $conf->get('cachetime'), // Врямя жизни кеша | |
'caching' => true , // принудительное включение кеша | |
); | |
$JСache = new JCache($options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment