From aa36d086b48ec6fa4d960cb784251f9c822bde87 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Wed, 1 Dec 2010 00:26:03 +0000 Subject: #978144 by Damien Tournoud: Fixed cache_get_multiple() inconsistent with cache_get() --- includes/cache.inc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'includes') diff --git a/includes/cache.inc b/includes/cache.inc index 460903913..21630617d 100644 --- a/includes/cache.inc +++ b/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) { -- cgit v1.2.3