You are here

function cacheflush_cron_clear_preset in CacheFlush 8

Cron job callback for cacheflush.

Parameters

Drupal\ultimate_cron\Entity\CronJob $job: CronJob entity.

1 string reference to 'cacheflush_cron_clear_preset'
cacheflush_cron_cacheflush_update in modules/cacheflush_cron/cacheflush_cron.module
Implements hook_ENTITY_TYPE_update().

File

modules/cacheflush_cron/cacheflush_cron.module, line 128
Cacheflush cron module.

Code

function cacheflush_cron_clear_preset(CronJob $job) {
  $cacheflush = \Drupal::service('cacheflush.api');

  // @Todo: if Drupal\ultimate_cron\Entity\CronJob will let it in the future in any way to send data to callback get rid of this and make it better.
  $entity = cacheflush_load(str_replace('cacheflush_preset_', '', $job
    ->get('id')));
  $cacheflush
    ->clearById($entity);
}