Please, help me... I can not set the TTL cache for the Joomla module. This is -
$cache->setLifeTime(20);
My code:
$cache = & JFactory::getCache('my_custom_mod', '');
$cacheKey = (string)$urls->serialize();
if (!($data = $cache->get($cacheKey))){
foreach ($urls as $i => $url){
$data[$i] = file_get_contents($url);
}
$cache->setLifeTime(20);
$cache->store($data, $cacheKey);
}
Any ideas? Thanks for your advice.
$cache = JFactory::getCache('mod_jexchange_rates_cbr', ''); // Any unique name $cache->setCaching(true); // Force cache enable. If caching is disabled though, that would be why your data isn’t actually writing to cache. If you need it to persist regardless of global cache setting. $cache->setLifeTime(60); //Minutes