Removing dead code in Cache.

Adding tests for ApcEngine::clear().
This commit is contained in:
mark_story 2010-09-18 12:52:08 -04:00
parent b6d845adc4
commit 7518d0e804
3 changed files with 14 additions and 7 deletions

View file

@ -414,12 +414,6 @@ class Cache {
* @return boolean True if the cache was succesfully cleared, false otherwise
*/
public static function clear($check = false, $config = 'default') {
$settings = self::settings($config);
if (empty($settings)) {
return null;
}
if (!self::isInitialized($config)) {
return false;
}

View file

@ -106,7 +106,7 @@ class ApcEngine extends CacheEngine {
}
/**
* Delete all keys from the cache
* Delete all keys from the cache. This will clear every cache config using APC.
*
* @return boolean True if the cache was succesfully cleared, false otherwise
*/

View file

@ -193,4 +193,17 @@ class ApcEngineTest extends CakeTestCase {
$result = Cache::read('test_increment', 'apc');
$this->assertEqual(8, $result);
}
/**
* test the clearing of cache keys
*
* @return void
*/
function testClear() {
Cache::write('some_value', 'value', 'apc');
$result = Cache::clear(false, 'apc');
$this->assertTrue($result);
$this->assertFalse(Cache::read('some_value', 'apc'));
}
}