diff --git a/core/lib/Drupal/Core/Cache/BackendChain.php b/core/lib/Drupal/Core/Cache/BackendChain.php index 548d62df02912c171bf79a2d572b3aa41c6f147b..d3fac6e111d2b1e76b7942441d9820b7a071154e 100644 --- a/core/lib/Drupal/Core/Cache/BackendChain.php +++ b/core/lib/Drupal/Core/Cache/BackendChain.php @@ -165,15 +165,6 @@ public function deleteAll() { } } - /** - * Implements Drupal\Core\Cache\CacheBackendInterface::expire(). - */ - public function deleteExpired() { - foreach ($this->backends as $backend) { - $backend->deleteExpired(); - } - } - /** * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate(). */ diff --git a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php index b29ef9b3c3006cffa25865c88d537b503bccf08a..d38a0946cef9216c6d92da435ba293946a221f5a 100644 --- a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php +++ b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php @@ -43,8 +43,8 @@ * @endcode * * There are two ways to "remove" a cache item: - * - Deletion (using delete(), deleteMultiple(), deleteTags(), deleteAll() or - * deleteExpired()): Permanently removes the item from the cache. + * - Deletion (using delete(), deleteMultiple(), deleteTags() or deleteAll()): + * Permanently removes the item from the cache. * - Invalidation (using invalidate(), invalidateMultiple(), invalidateTags() * or invalidateAll()): a "soft" delete that only marks the items as * "invalid", meaning "not fresh" or "not fresh enough". Invalid items are @@ -163,7 +163,6 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired() */ public function delete($cid); @@ -183,7 +182,6 @@ public function delete($cid); * @see Drupal\Core\Cache\CacheBackendInterface::delete() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired() */ public function deleteMultiple(array $cids); @@ -205,7 +203,6 @@ public function deleteMultiple(array $cids); * @see Drupal\Core\Cache\CacheBackendInterface::delete() * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired() */ public function deleteTags(array $tags); @@ -216,21 +213,9 @@ public function deleteTags(array $tags); * @see Drupal\Core\Cache\CacheBackendInterface::delete() * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired() */ public function deleteAll(); - /** - * Deletes expired items from the cache. - * - * @see Drupal\Core\Cache\CacheBackendInterface::delete() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() - * @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired() - */ - public function deleteExpired(); - /** * Marks a cache item as invalid. * diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index e4d86c6b5ad0dc219d48ddc991a5b53428b05566..1c3f2a0bca5134da1e70c4015d229977e092ddb8 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -192,16 +192,6 @@ public function deleteAll() { Database::getConnection()->truncate($this->bin)->execute(); } - /** - * Implements Drupal\Core\Cache\CacheBackendInterface::deleteExpired(). - */ - public function deleteExpired() { - Database::getConnection()->delete($this->bin) - ->condition('expire', CacheBackendInterface::CACHE_PERMANENT, '<>') - ->condition('expire', REQUEST_TIME, '<') - ->execute(); - } - /** * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate(). */ @@ -251,7 +241,10 @@ public function invalidateAll() { * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). */ public function garbageCollection() { - $this->deleteExpired(); + Database::getConnection()->delete($this->bin) + ->condition('expire', CacheBackendInterface::CACHE_PERMANENT, '<>') + ->condition('expire', REQUEST_TIME, '<') + ->execute(); } /** diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php index 5cd895ff6eef794d42e32ee132df69adf67babd5..ac83a06ff35adaa4e27c3cb4bed3ec24e35e1852 100644 --- a/core/lib/Drupal/Core/Cache/MemoryBackend.php +++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php @@ -138,16 +138,6 @@ public function deleteAll() { $this->cache = array(); } - /** - * Implements Drupal\Core\Cache\CacheBackendInterface::deleteExpired(). - * - * Cache expiration is not implemented for MemoryBackend as this backend only - * persists during a single request and expiration are done using - * REQUEST_TIME. - */ - public function deleteExpired() { - } - /** * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate(). */ diff --git a/core/lib/Drupal/Core/Cache/NullBackend.php b/core/lib/Drupal/Core/Cache/NullBackend.php index 8b3565d61757c2974e288bd66bbd48c3e89b3cf9..16c03312f09a1f327e5054aeb87b0b289271f4a6 100644 --- a/core/lib/Drupal/Core/Cache/NullBackend.php +++ b/core/lib/Drupal/Core/Cache/NullBackend.php @@ -62,11 +62,6 @@ public function deleteMultiple(array $cids) {} */ public function deleteAll() {} - /** - * Implements Drupal\Core\Cache\CacheBackendInterface::deleteExpired(). - */ - public function deleteExpired() {} - /** * Implements Drupal\Core\Cache\CacheBackendInterface::deleteTags(). */ diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/CacheTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Cache/CacheTestBase.php index dd1dea990ed78739f105e434a61d13db8c98696e..e2c552b2d9836ec2aafb1f80da1e9ee54a33568a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/CacheTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/CacheTestBase.php @@ -87,18 +87,4 @@ function assertCacheRemoved($message, $cid = NULL, $bin = NULL) { $cached = cache($bin)->get($cid); $this->assertFalse($cached, $message); } - - /** - * Performs a general wipe of the bin. - * - * @param $bin - * The bin to perform the wipe on. - */ - protected function generalWipe($bin = NULL) { - if ($bin == NULL) { - $bin = $this->default_bin; - } - - cache($bin)->deleteExpired(); - } } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 315add70f22b59fe5db56483e26f8c809f9de33e..cd016f4370f1f2e46de20304c0c58e16de65fd0d 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3550,7 +3550,7 @@ function system_cron() { $cache_bins = array_merge(module_invoke_all('cache_flush'), array('form', 'menu')); foreach ($cache_bins as $bin) { - cache($bin)->deleteExpired(); + cache($bin)->garbageCollection(); } // Cleanup the batch table and the queue for failed batches.