Making XcacheTest use refactored Cache API.

This commit is contained in:
mark_story 2009-11-21 15:44:03 -05:00
parent 3f067ed166
commit fb7d99e6b3
2 changed files with 4 additions and 5 deletions

View file

@ -2,7 +2,6 @@
/**
* Xcache storage engine for cache.
*
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
@ -68,7 +67,7 @@ class XcacheEngine extends CacheEngine {
*/
function write($key, &$value, $duration) {
$expires = time() + $duration;
xcache_set($key.'_expires', $expires, $duration);
xcache_set($key . '_expires', $expires, $duration);
return xcache_set($key, $value, $duration);
}
@ -82,7 +81,7 @@ class XcacheEngine extends CacheEngine {
function read($key) {
if (xcache_isset($key)) {
$time = time();
$cachetime = intval(xcache_get($key.'_expires'));
$cachetime = intval(xcache_get($key . '_expires'));
if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) {
return false;
}

View file

@ -39,7 +39,7 @@ class XcacheEngineTest extends UnitTestCase {
*/
function skip() {
$skip = true;
if ($result = Cache::engine('Xcache')) {
if (function_exists('xcache_set')) {
$skip = false;
}
$this->skipIf($skip, '%s Xcache is not installed or configured properly');
@ -132,7 +132,7 @@ class XcacheEngineTest extends UnitTestCase {
$result = Cache::read('other_test');
$this->assertFalse($result);
Cache::set(array('duration' => "+1 second"));
Cache::set(array('duration' => 1));
$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('other_test', $data);