You are here

public function CdnWarmer::buildIdsBatch in Warmer 8

Same name and namespace in other branches
  1. 2.x modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php \Drupal\warmer_cdn\Plugin\warmer\CdnWarmer::buildIdsBatch()

Builds the next batch of IDs based on a position cursor.

Parameters

mixed $cursor: The position of the last generate batch.

Return value

array The array of item IDs.

Overrides WarmerInterface::buildIdsBatch

File

modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php, line 105

Class

CdnWarmer
The cache warmer for the built-in entity cache.

Namespace

Drupal\warmer_cdn\Plugin\warmer

Code

public function buildIdsBatch($cursor) {

  // Parse the sitemaps and extract the URLs.
  $config = $this
    ->getConfiguration();
  $urls = empty($config['urls']) ? [] : $config['urls'];
  $cursor_position = is_null($cursor) ? -1 : array_search($cursor, $urls);
  if ($cursor_position === FALSE) {
    return [];
  }
  return array_slice($urls, $cursor_position + 1, (int) $this
    ->getBatchSize());
}