Back to BaseDatabaseModel class

Method cleanCache

protected void
cleanCache
(mixed $group = null)
Clean the cache
Parameters
  • string $group The cache group
Returns
  • void
Since
  • 3.0

Method cleanCache - Source code

/**
 * Clean the cache
 *
 * @param   string  $group  The cache group
 *
 * @return  void
 *
 * @since   3.0
 */
protected function cleanCache($group = null)
{
    $app = Factory::getApplication();
    $options = ['defaultgroup' => $group ?: $this->option ?? $app->input->get('option'), 'cachebase' => $app->get('cache_path', JPATH_CACHE), 'result' => true];
    try {
        /** @var CallbackController $cache */
        $cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController('callback', $options);
        $cache->clean();
    } catch (CacheExceptionInterface $exception) {
        $options['result'] = false;
    }
    // Trigger the onContentCleanCache event.
    $this->dispatchEvent(new Event($this->event_clean_cache, $options));
}