You are here

public function DatabaseRawBackend::garbageCollection in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/DatabaseRawBackend.php \Drupal\supercache\Cache\DatabaseRawBackend::garbageCollection()

Performs garbage collection on a cache bin.

The backend may choose to delete expired or invalidated items.

Overrides CacheRawBackendInterface::garbageCollection

File

src/Cache/DatabaseRawBackend.php, line 323
Contains \Drupal\supercache\Cache\DatabaseRawBackend.

Class

DatabaseRawBackend
Defines a default cache implementation.

Namespace

Drupal\supercache\Cache

Code

public function garbageCollection() {
  try {
    $this->connection
      ->delete($this->bin)
      ->condition('expire', CacheRawBackendInterface::CACHE_PERMANENT, '<>')
      ->condition('expire', $this->requestTime, '<')
      ->execute();
  } catch (\Exception $e) {

    // If the table does not exist, it surely does not have garbage in it.
    // If the table exists, the next garbage collection will clean up.
    // There is nothing to do.
  }
}