aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cache/driver
diff options
context:
space:
mode:
authorv12mike <github@ingenious.co.nz>2018-07-15 21:50:18 +0100
committerMarc Alexander <admin@m-a-styles.de>2018-09-16 16:05:22 +0200
commit02234783c6f0fd9b15faf7a17d3bb8b1d39da557 (patch)
tree64f3098bdc313cc83d9b2367643f881c4203ad31 /phpBB/phpbb/cache/driver
parent04899d1efd261493111e309600531d363b73bc46 (diff)
downloadforums-02234783c6f0fd9b15faf7a17d3bb8b1d39da557.tar
forums-02234783c6f0fd9b15faf7a17d3bb8b1d39da557.tar.gz
forums-02234783c6f0fd9b15faf7a17d3bb8b1d39da557.tar.bz2
forums-02234783c6f0fd9b15faf7a17d3bb8b1d39da557.tar.xz
forums-02234783c6f0fd9b15faf7a17d3bb8b1d39da557.zip
[ticket/15726] Implement selective purge in APCu cache driver
The current APCu cache driver implements a global clearing of the APCu when the phpBB cache is purged. This is inappropriate if there are other phpBB boards, or other php applications sharing the APCu cache. This patch changes the behviour so that only cache entries matching the key_prefix of this board are cleared by a phpBB cache purge. The APCu unit test script has been updated to test this behaviour. It has also been updated so that the test case can be run individually previously it relied on initialisations made in other test scripts. PHPBB3-15726
Diffstat (limited to 'phpBB/phpbb/cache/driver')
-rwxr-xr-x[-rw-r--r--]phpBB/phpbb/cache/driver/apcu.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php
index 40192e4026..6a65e7155a 100644..100755
--- a/phpBB/phpbb/cache/driver/apcu.php
+++ b/phpBB/phpbb/cache/driver/apcu.php
@@ -25,7 +25,11 @@ class apcu extends \phpbb\cache\driver\memory
*/
function purge()
{
- apcu_clear_cache();
+ /* use an iterator to selectively clear 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();
}