From 02234783c6f0fd9b15faf7a17d3bb8b1d39da557 Mon Sep 17 00:00:00 2001 From: v12mike Date: Sun, 15 Jul 2018 21:50:18 +0100 Subject: [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 --- phpBB/phpbb/cache/driver/apcu.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 phpBB/phpbb/cache/driver/apcu.php (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php old mode 100644 new mode 100755 index 40192e4026..6a65e7155a --- 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(); } -- cgit v1.2.1 From 63a3033f15428b1af9a121708eb4a2bd4bef43c0 Mon Sep 17 00:00:00 2001 From: v12mike Date: Mon, 16 Jul 2018 06:36:38 +0200 Subject: [ticket/15726] Implement selective purge in APCu cache driver Fix whitespace PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index 6a65e7155a..754fb1fce2 100755 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -25,11 +25,10 @@ class apcu extends \phpbb\cache\driver\memory */ function purge() { - /* 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 . '#')); - + /* 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(); } -- cgit v1.2.1 From 7d4d9770cfc38d613c3cf2b8495d2f8e63623ebd Mon Sep 17 00:00:00 2001 From: v12mike Date: Mon, 16 Jul 2018 07:26:14 +0100 Subject: [ticket/15726] Implement selective purge in APCu cache driver fix file permissions PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 phpBB/phpbb/cache/driver/apcu.php (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php old mode 100755 new mode 100644 -- cgit v1.2.1 From bf9af922208ad93c2afbe4fa9462f8914c8d4363 Mon Sep 17 00:00:00 2001 From: v12mike Date: Wed, 25 Jul 2018 19:36:25 +0100 Subject: [ticket/15726] Implement selective purge in APCu cache driver Correcting code formatting and whitespace PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index 754fb1fce2..e40d5a376c 100644 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -25,9 +25,10 @@ class apcu extends \phpbb\cache\driver\memory */ function purge() { - /* use an iterator to selectively clear our cache entries without - disturbing any other cache users - (e.g. other phpBB boards hosted on this server) */ + /* + 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(); -- cgit v1.2.1 From 7f1f64b1dcebb28ab575e1905676471b473d08ed Mon Sep 17 00:00:00 2001 From: v12mike Date: Thu, 26 Jul 2018 06:09:02 +0100 Subject: [ticket/15726] Implement selective purge in APCu cache driver Fix whitespace PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index e40d5a376c..3a63a97e4e 100644 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -25,9 +25,9 @@ class apcu extends \phpbb\cache\driver\memory */ function purge() { - /* - Use an iterator to selectively clear our cache entries without disturbing - any other cache users (e.g. other phpBB boards hosted on this server) + /* + * 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 . '#')); -- cgit v1.2.1 From 33268e5a72b3858c09d97bb696a21911ec139815 Mon Sep 17 00:00:00 2001 From: v12mike Date: Thu, 26 Jul 2018 17:24:42 +0200 Subject: [ticket/15726] Implement selective purge in APCu cache driver Edit comment PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index 3a63a97e4e..4b06fdb002 100644 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -26,7 +26,7 @@ class apcu extends \phpbb\cache\driver\memory function purge() { /* - * Use an iterator to selectively clear our cache entries without disturbing + * 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 . '#')); -- cgit v1.2.1 From 5edb33036654fad4df63507f00934b0d078e2756 Mon Sep 17 00:00:00 2001 From: v12mike Date: Sun, 29 Jul 2018 09:15:12 +0100 Subject: [ticket/15726] Implement selective purge in APCu fix indentation of comment PHPBB3-15726 --- phpBB/phpbb/cache/driver/apcu.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/cache/driver/apcu.php') diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index 4b06fdb002..c96cf0de57 100644 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -25,10 +25,10 @@ class apcu extends \phpbb\cache\driver\memory */ function purge() { - /* - * Use an iterator to selectively delete our cache entries without disturbing - * any other cache users (e.g. other phpBB boards hosted on this server) - */ + /* + * 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(); -- cgit v1.2.1