Permalink
Browse files

Making XcacheTest use refactored Cache API.

  • Loading branch information...
1 parent 3f067ed commit fb7d99e6b3fd2276cb1f358f7498fbe3cc781a0d @markstory markstory committed Nov 21, 2009
Showing with 4 additions and 5 deletions.
  1. +2 −3 cake/libs/cache/xcache.php
  2. +2 −2 cake/tests/cases/libs/cache/xcache.test.php
@@ -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 @@ function init($settings) {
*/
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 @@ function write($key, &$value, $duration) {
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;
}
@@ -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 @@ function testExpiry() {
$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);

0 comments on commit fb7d99e

Please sign in to comment.