2

According to https://docs.joomla.org/Using_caching_to_speed_up_your_code ,I must use $cache->cleanCache(); if I want to clear the joomla cache in my custom script. That function throws the error "does not have a method cleanCache". As far as I could see in the API, the new method is called "clean". However, that also doesn't clear the cache (I can still see the cache files via ftp). Is is something that is broken?

I am using Joomla 3.7.3

1

Yeah, the documentation is wrong. This is how it's done. I found your question while asking the same thing myself, and I realized that I was going to have to figure it out. Not tough after reading the com_cache/cache model. Modify the cache path if you're in /administrator

$conf = JFactory::getConfig();
$options = array(
    'defaultgroup' => '',
    'storage'      => $conf->get('cache_handler', ''),
    'caching'      => true,
    'cachebase'    => $conf->get('cache_path', JPATH_SITE . '/cache')
);
$cache = JCache::getInstance('', $options);
$cache->clean('your_extension_here');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.