mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 22:38:52 +00:00
Merge branch '3.2.x'
This commit is contained in:
commit
58dd39f781
2 changed files with 22 additions and 1 deletions
6
phpBB/phpbb/cache/driver/apcu.php
vendored
6
phpBB/phpbb/cache/driver/apcu.php
vendored
|
@ -25,7 +25,11 @@ class apcu extends \phpbb\cache\driver\memory
|
||||||
*/
|
*/
|
||||||
function purge()
|
function purge()
|
||||||
{
|
{
|
||||||
apcu_clear_cache();
|
/*
|
||||||
|
* Use an iterator to selectively delete our cache entries without disturbing
|
||||||
|
* any other cache users (e.g. other phpBB boards hosted on this server)
|
||||||
|
*/
|
||||||
|
apcu_delete(new \APCUIterator('#^' . $this->key_prefix . '#'));
|
||||||
|
|
||||||
parent::purge();
|
parent::purge();
|
||||||
}
|
}
|
||||||
|
|
17
tests/cache/apcu_driver_test.php
vendored
17
tests/cache/apcu_driver_test.php
vendored
|
@ -49,10 +49,27 @@ class phpbb_cache_apcu_driver_test extends phpbb_cache_common_test_case
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
global $phpbb_container, $phpbb_root_path;
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
$phpbb_container = new phpbb_mock_container_builder();
|
||||||
|
$phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
|
||||||
|
|
||||||
$this->driver = new \phpbb\cache\driver\apcu;
|
$this->driver = new \phpbb\cache\driver\apcu;
|
||||||
|
|
||||||
$this->driver->purge();
|
$this->driver->purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_purge()
|
||||||
|
{
|
||||||
|
/* add a cache entry which does not match our key */
|
||||||
|
$foreign_key = 'test_' . $this->driver->key_prefix . 'test';
|
||||||
|
$this->assertSame(true, apcu_store($foreign_key, 0, 600));
|
||||||
|
$this->assertSame(true, apcu_exists($foreign_key));
|
||||||
|
|
||||||
|
parent::test_purge();
|
||||||
|
|
||||||
|
$this->assertSame(true, apcu_exists($foreign_key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue