On this page
public function DatabaseBackend::garbageCollection
public DatabaseBackend::garbageCollection()
Performs garbage collection on a cache bin.
The backend may choose to delete expired or invalidated items.
Overrides CacheBackendInterface::garbageCollection
File
- core/lib/Drupal/Core/Cache/DatabaseBackend.php, line 327
Class
- DatabaseBackend
- Defines a default cache implementation.
Namespace
Drupal\Core\CacheCode
public function garbageCollection() {
try {
$this->connection->delete($this->bin)
->condition('expire', Cache::PERMANENT, '<>')
->condition('expire', REQUEST_TIME, '<')
->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.
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!DatabaseBackend.php/function/DatabaseBackend::garbageCollection/8.1.x