Commit 980cb9c5 authored by catch's avatar catch

Issue #1944646 by c960657: Remove CacheBackendInterface::deleteExpired().

parent 5d6cd82c
...@@ -165,15 +165,6 @@ public function deleteAll() { ...@@ -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(). * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
*/ */
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
* @endcode * @endcode
* *
* There are two ways to "remove" a cache item: * There are two ways to "remove" a cache item:
* - Deletion (using delete(), deleteMultiple(), deleteTags(), deleteAll() or * - Deletion (using delete(), deleteMultiple(), deleteTags() or deleteAll()):
* deleteExpired()): Permanently removes the item from the cache. * Permanently removes the item from the cache.
* - Invalidation (using invalidate(), invalidateMultiple(), invalidateTags() * - Invalidation (using invalidate(), invalidateMultiple(), invalidateTags()
* or invalidateAll()): a "soft" delete that only marks the items as * or invalidateAll()): a "soft" delete that only marks the items as
* "invalid", meaning "not fresh" or "not fresh enough". Invalid items are * "invalid", meaning "not fresh" or "not fresh enough". Invalid items are
...@@ -163,7 +163,6 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN ...@@ -163,7 +163,6 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN
* @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired()
*/ */
public function delete($cid); public function delete($cid);
...@@ -183,7 +182,6 @@ public function delete($cid); ...@@ -183,7 +182,6 @@ public function delete($cid);
* @see Drupal\Core\Cache\CacheBackendInterface::delete() * @see Drupal\Core\Cache\CacheBackendInterface::delete()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired()
*/ */
public function deleteMultiple(array $cids); public function deleteMultiple(array $cids);
...@@ -205,7 +203,6 @@ 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::delete()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteAll() * @see Drupal\Core\Cache\CacheBackendInterface::deleteAll()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired()
*/ */
public function deleteTags(array $tags); public function deleteTags(array $tags);
...@@ -216,21 +213,9 @@ 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::delete()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple() * @see Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteTags() * @see Drupal\Core\Cache\CacheBackendInterface::deleteTags()
* @see Drupal\Core\Cache\CacheBackendInterface::deleteExpired()
*/ */
public function deleteAll(); 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. * Marks a cache item as invalid.
* *
......
...@@ -192,16 +192,6 @@ public function deleteAll() { ...@@ -192,16 +192,6 @@ public function deleteAll() {
Database::getConnection()->truncate($this->bin)->execute(); 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(). * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
*/ */
...@@ -251,7 +241,10 @@ public function invalidateAll() { ...@@ -251,7 +241,10 @@ public function invalidateAll() {
* Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection().
*/ */
public function garbageCollection() { public function garbageCollection() {
$this->deleteExpired(); Database::getConnection()->delete($this->bin)
->condition('expire', CacheBackendInterface::CACHE_PERMANENT, '<>')
->condition('expire', REQUEST_TIME, '<')
->execute();
} }
/** /**
......
...@@ -138,16 +138,6 @@ public function deleteAll() { ...@@ -138,16 +138,6 @@ public function deleteAll() {
$this->cache = array(); $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(). * Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
*/ */
......
...@@ -62,11 +62,6 @@ public function deleteMultiple(array $cids) {} ...@@ -62,11 +62,6 @@ public function deleteMultiple(array $cids) {}
*/ */
public function deleteAll() {} public function deleteAll() {}
/**
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteExpired().
*/
public function deleteExpired() {}
/** /**
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteTags(). * Implements Drupal\Core\Cache\CacheBackendInterface::deleteTags().
*/ */
......
...@@ -87,18 +87,4 @@ function assertCacheRemoved($message, $cid = NULL, $bin = NULL) { ...@@ -87,18 +87,4 @@ function assertCacheRemoved($message, $cid = NULL, $bin = NULL) {
$cached = cache($bin)->get($cid); $cached = cache($bin)->get($cid);
$this->assertFalse($cached, $message); $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();
}
} }
...@@ -3550,7 +3550,7 @@ function system_cron() { ...@@ -3550,7 +3550,7 @@ function system_cron() {
$cache_bins = array_merge(module_invoke_all('cache_flush'), array('form', 'menu')); $cache_bins = array_merge(module_invoke_all('cache_flush'), array('form', 'menu'));
foreach ($cache_bins as $bin) { foreach ($cache_bins as $bin) {
cache($bin)->deleteExpired(); cache($bin)->garbageCollection();
} }
// Cleanup the batch table and the queue for failed batches. // Cleanup the batch table and the queue for failed batches.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment