public function resetStaleCache($count = 100, $time = 86400) {
    $timer = 'reset_stale_cache';
    Timer::start($timer);

    $result = $this->queryFactory->get(self::ENTITY_TYPE)
      ->condition('field_gfc_created', REQUEST_TIME - $time, '<')
      ->execute();
    if (empty($result)) {
      $this->logger->info('No stale cache was found. Nothing to clear.');
      Timer::stop($timer);
      return;
    }

    $this->removeByChunk($result, $count);

    $msg = 'The stale cache was cleared. [items removed: %items, elapsed time: %time sec.]';
    $this->logger->info(
      $msg,
      [
        '%items' => count($result),
        '%time' => round(Timer::read($timer) / 1000, 1)
      ]
    );

    Timer::stop($timer);
  }
public function resetStaleCache($count = 100, $time = 86400) {
    $timer = 'reset_stale_cache';
    Timer::start($timer);

    $result = $this->queryFactory->get(self::ENTITY_TYPE)
      ->condition('field_gfc_created', REQUEST_TIME - $time, '<')
      ->execute();
    if (empty($result)) {
      $this->logger->info('No stale cache was found. Nothing to clear.');
      Timer::stop($timer);
      return;
    }

    $this->removeByChunk($result, $count);

    $msg = 'The stale cache was cleared. [items removed: %items, elapsed time: %time sec.]';
    $this->logger->info(
      $msg,
      [
        '%items' => count($result),
        '%time' => round(Timer::read($timer) / 1000, 1)
      ]
    );

    Timer::stop($timer);
  }
public function resetStaleCache ( $ count = 100 , $ time = 86400 ) { $ timer = 'reset_stale_cache' ; Timer :: start ( $ timer ) ; $ result = $ this -> queryFactory -> get ( self :: ENTITY_TYPE ) -> condition ( 'field_gfc_created' , REQUEST_TIME - $ time , '<' ) -> execute ( ) ; if ( empty ( $ result ) ) { $ this -> logger -> info ( 'No stale cache was found. Nothing to clear.' ) ; Timer :: stop ( $ timer ) ; return ; } $ this -> removeByChunk ( $ result , $ count ) ; $ msg = 'The stale cache was cleared. [items removed: %items, elapsed time: %time sec.]' ; $ this -> logger -> info ( $ msg , [ '%items' => count ( $ result ) , '%time' => round ( Timer :: read ( $ timer ) / 1000 , 1 ) ] ) ; Timer :: stop ( $ timer ) ; }
Remove stale cache.

@param int $count
Size of the chunk.
@param int $time
Time frame to calc stale cache.
Remove stale cache .