mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Removing dead code in Cache.
Adding tests for ApcEngine::clear().
This commit is contained in:
parent
b6d845adc4
commit
7518d0e804
3 changed files with 14 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
|
2
cake/libs/cache/apc.php
vendored
2
cake/libs/cache/apc.php
vendored
|
@ -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
|
||||
*/
|
||||
|
|
13
cake/tests/cases/libs/cache/apc.test.php
vendored
13
cake/tests/cases/libs/cache/apc.test.php
vendored
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue