mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making XcacheTest use refactored Cache API.
This commit is contained in:
parent
3f067ed166
commit
fb7d99e6b3
2 changed files with 4 additions and 5 deletions
5
cake/libs/cache/xcache.php
vendored
5
cake/libs/cache/xcache.php
vendored
|
@ -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;
|
||||
}
|
||||
|
|
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue