caching - PHP script to clear cache in Joomla 3.x

one text

I created the following script and put it to cron job on server. Unfortunately it does not work.

include 'includes/defines.php';
include 'includes/framework.php';

$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('cachegroup');

Do you have an idea what is wrong?

Source