Removing exception throwing from CacheEngine::gc() and subclasses as it randomly caused errors when using one of the affected engines.

This commit is contained in:
Mark Story 2010-04-19 00:04:34 -04:00
parent b7e4e46251
commit c05c9857ac
4 changed files with 4 additions and 22 deletions

View file

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

View file

@ -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.'));
}
}
?>

View file

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

View file

@ -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);