#978144: remove inconsistencies and code duplication between DrupalDatabaseCache::get() and DrupalDatabaseCache::getMultiple(). From: Damien Tournoud --- cache.inc | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git includes/cache.inc includes/cache.inc index 7f5154e..59c93b0 100644 --- includes/cache.inc +++ includes/cache.inc @@ -316,17 +316,9 @@ class DrupalDatabaseCache implements DrupalCacheInterface { } function get($cid) { - try { - // Garbage collection necessary when enforcing a minimum cache lifetime. - $this->garbageCollection($this->bin); - $cache = db_query("SELECT data, created, expire, serialized FROM {" . $this->bin . "} WHERE cid = :cid", array(':cid' => $cid))->fetchObject(); - return $this->prepareItem($cache); - } - catch (Exception $e) { - // If the database is never going to be available, cache requests should - // return FALSE in order to allow exception handling to occur. - return FALSE; - } + $cids = array($cid); + $cache = $this->getMultiple($cids); + return reset($cache); } function getMultiple(&$cids) {