From c05c9857ac85bdd6c5935bf0134845a5727aa443 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 19 Apr 2010 00:04:34 -0400 Subject: [PATCH] Removing exception throwing from CacheEngine::gc() and subclasses as it randomly caused errors when using one of the affected engines. --- cake/libs/cache.php | 2 +- cake/libs/cache/apc.php | 9 --------- cake/libs/cache/memcache.php | 10 ---------- cake/libs/cache/xcache.php | 5 +++-- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/cake/libs/cache.php b/cake/libs/cache.php index 318e7cefa..11ea708ee 100644 --- a/cake/libs/cache.php +++ b/cake/libs/cache.php @@ -521,7 +521,7 @@ abstract class CacheEngine { * Permanently remove all expired and deleted data * @return void */ - abstract public function gc(); + public function gc() { } /** * Write value for a key into cache diff --git a/cake/libs/cache/apc.php b/cake/libs/cache/apc.php index 9a1586a4c..ae5edf832 100644 --- a/cake/libs/cache/apc.php +++ b/cake/libs/cache/apc.php @@ -114,14 +114,5 @@ class ApcEngine extends CacheEngine { return apc_clear_cache('user'); } -/** - * Garbage collection not implemented in APC - * - * @return void - * @throws BadMethodCallException - */ - public function gc() { - throw new BadMethodCallException(__('Cannot gc() with APC.')); - } } ?> \ No newline at end of file diff --git a/cake/libs/cache/memcache.php b/cake/libs/cache/memcache.php index a1adb72e1..6b59211fb 100644 --- a/cake/libs/cache/memcache.php +++ b/cake/libs/cache/memcache.php @@ -177,16 +177,6 @@ class MemcacheEngine extends CacheEngine { return $this->__Memcache->flush(); } -/** - * Not implemented - Memcache does not provide a native way to do garbage collection - * - * @return void - * @throws BadMethodCallException - */ - public function gc() { - throw new BadMethodCallException(__('Cannot gc() with Memcache.')); - } - /** * Connects to a server in connection pool * diff --git a/cake/libs/cache/xcache.php b/cake/libs/cache/xcache.php index ef2dca124..2a6955dcc 100644 --- a/cake/libs/cache/xcache.php +++ b/cake/libs/cache/xcache.php @@ -49,7 +49,8 @@ class XcacheEngine extends CacheEngine { */ public function init($settings) { parent::init(array_merge(array( - 'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password' + 'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_ + PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password' ), $settings) ); return function_exists('xcache_info'); @@ -63,7 +64,7 @@ class XcacheEngine extends CacheEngine { * @param integer $duration How long to cache the data, in seconds * @return boolean True if the data was succesfully cached, false on failure */ - public function write($key, &$value, $duration) { + public function write($key, $value, $duration) { $expires = time() + $duration; xcache_set($key . '_expires', $expires, $duration); return xcache_set($key, $value, $duration);