You are here

public function FeedsHTTPCache::sync in Feeds 7.2

Removes files for which an entry no longer appears in the cache.

Parameters

array $files: The files to check.

File

includes/FeedsHTTPCache.inc, line 307
Contains FeedsHTTPCache class.

Class

FeedsHTTPCache
Cache implementation for the Feeds HTTP cache.

Code

public function sync(array $files) {
  if (count($files) > 50) {

    // There are more than 50 files in the cache directory to check. Take the
    // first 50 and put the rest on the queue.
    $queue = DrupalQueue::get('feeds_sync_cache_feeds_http');
    $queue
      ->createItem(array(
      'files' => array_slice($files, 50),
    ));

    // Pick the first 50.
    $files = array_slice($files, 0, 50);
  }

  // Try to load cache entries for each file. Since the file names are passed
  // by reference and the file names for which a cache entry is found are
  // removed from the array, we end up with a list of file names for which NO
  // cache entry is found.
  cache_get_multiple($files, $this->bin);

  // The files for which no cache entry is found, can be removed.
  $this
    ->deleteMultipleFiles($files);
}