diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index d723baace..9bc6be219 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/lib/Cake/Cache/Engine/XcacheEngine.php @@ -147,10 +147,10 @@ class XcacheEngine extends CacheEngine { public function groups() { $result = array(); foreach ($this->settings['groups'] as $group) { - $value = xcache_get($group); + $value = xcache_get($this->settings['prefix'] . $group); if (!$value) { $value = 1; - xcache_set($group, $value, 0); + xcache_set($this->settings['prefix'] . $group, $value, 0); } $result[] = $group . $value; } @@ -164,7 +164,7 @@ class XcacheEngine extends CacheEngine { * @return boolean success **/ public function clearGroup($group) { - return (bool) xcache_inc($group, 1); + return (bool) xcache_inc($this->settings['prefix'] . $group, 1); } /** diff --git a/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php index 3c62f036d..d59e17738 100644 --- a/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php @@ -207,16 +207,21 @@ class XcacheEngineTest extends CakeTestCase { * @return void */ public function testGroupsReadWrite() { - Cache::config('xcache_groups', array('engine' => 'Xcache', 'duration' => 0, 'groups' => array('group_a', 'group_b'))); + Cache::config('xcache_groups', array( + 'engine' => 'Xcache', + 'duration' => 0, + 'groups' => array('group_a', 'group_b'), + 'prefix' => 'test_' + )); $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups')); $this->assertEquals('value', Cache::read('test_groups', 'xcache_groups')); - xcache_inc('group_a', 1); + xcache_inc('test_group_a', 1); $this->assertFalse(Cache::read('test_groups', 'xcache_groups')); $this->assertTrue(Cache::write('test_groups', 'value2', 'xcache_groups')); $this->assertEquals('value2', Cache::read('test_groups', 'xcache_groups')); - xcache_inc('group_b', 1); + xcache_inc('test_group_b', 1); $this->assertFalse(Cache::read('test_groups', 'xcache_groups')); $this->assertTrue(Cache::write('test_groups', 'value3', 'xcache_groups')); $this->assertEquals('value3', Cache::read('test_groups', 'xcache_groups')); @@ -228,7 +233,12 @@ class XcacheEngineTest extends CakeTestCase { * @return void */ public function testGroupDelete() { - Cache::config('xcache_groups', array('engine' => 'Xcache', 'duration' => 0, 'groups' => array('group_a', 'group_b'))); + Cache::config('xcache_groups', array( + 'engine' => 'Xcache', + 'duration' => 0, + 'groups' => array('group_a', 'group_b'), + 'prefix' => 'test_' + )); $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups')); $this->assertEquals('value', Cache::read('test_groups', 'xcache_groups')); $this->assertTrue(Cache::delete('test_groups', 'xcache_groups')); @@ -242,7 +252,12 @@ class XcacheEngineTest extends CakeTestCase { * @return void **/ public function testGroupClear() { - Cache::config('xcache_groups', array('engine' => 'Xcache', 'duration' => 0, 'groups' => array('group_a', 'group_b'))); + Cache::config('xcache_groups', array( + 'engine' => 'Xcache', + 'duration' => 0, + 'groups' => array('group_a', 'group_b'), + 'prefix' => 'test_' + )); $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups')); $this->assertTrue(Cache::clearGroup('group_a', 'xcache_groups'));