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

8.0.x
catch 2013-03-20 11:44:29 +00:00
parent 5d6cd82cce
commit 980cb9c548
7 changed files with 7 additions and 67 deletions

View File

@ -165,15 +165,6 @@ class BackendChain implements CacheBackendInterface {
}
}
/**
* Implements Drupal\Core\Cache\CacheBackendInterface::expire().
*/
public function deleteExpired() {
foreach ($this->backends as $backend) {
$backend->deleteExpired();
}
}
/**
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
*/

View File

@ -43,8 +43,8 @@ namespace Drupal\Core\Cache;
* @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 @@ interface CacheBackendInterface {
* @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 @@ interface CacheBackendInterface {
* @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 @@ interface CacheBackendInterface {
* @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 @@ interface CacheBackendInterface {
* @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.
*

View File

@ -192,16 +192,6 @@ class DatabaseBackend implements CacheBackendInterface {
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 @@ class DatabaseBackend implements CacheBackendInterface {
* 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();
}
/**

View File

@ -138,16 +138,6 @@ class MemoryBackend implements CacheBackendInterface {
$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().
*/

View File

@ -62,11 +62,6 @@ class NullBackend implements CacheBackendInterface {
*/
public function deleteAll() {}
/**
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteExpired().
*/
public function deleteExpired() {}
/**
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteTags().
*/

View File

@ -87,18 +87,4 @@ abstract class CacheTestBase extends WebTestBase {
$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();
}
}

View File

@ -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.