Skip to content

Instantly share code, notes, and snippets.

@m7v
Created March 28, 2014 00:54
Show Gist options
  • Save m7v/9822675 to your computer and use it in GitHub Desktop.
Save m7v/9822675 to your computer and use it in GitHub Desktop.
Hook_cron
/**
* Implements hook_cron().
*/
function spaint_cache_cron() {
// Set interval for run cron. Default value is 1 day.
$interval = variable_get('spaint_cache_cron_interval', 86400);
if (time() >= variable_get('spaint_cache_cron_next_execution', 0)) {
spaint_cache_set_data_about_user_tracks();
watchdog('success', t('Cache set for user\'s count tracks is successful'));
spaint_cache_set_data_about_user_votes();
watchdog('success', t('Cache set for user\'s votes is successful'));
spaint_cache_set_data_about_tracks_votes();
watchdog('success', t('Cache set for track\'s votes is successful'));
// Set interval for the next run cron.
variable_set('spaint_cache_cron_execution', time() + $interval);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment