Don Daniello
Member
Adding the patch below allows using APCu without APC-BC (backwards compatibility). Some environments don't provide the backwards-compatibility package for APCu and nobody is actually using the "real" APC these days, so it doesn't make sense to make it impossible to use APCu directly.
The code could be modified to automatically detect which one is available based on
Configuration:
The code could be modified to automatically detect which one is available based on
apc_fetch/apcu_fetch
existence.
Diff:
--- src/XF/CacheFactory.php.bak 2019-01-27 01:32:31.924677238 +0100
+++ src/XF/CacheFactory.php 2019-01-27 01:33:03.213712677 +0100
@@ -92,6 +92,16 @@
return new Cache\ApcCache();
}
+ protected function createApcuCache(array $config)
+ {
+ if (!function_exists('apcu_fetch'))
+ {
+ throw new \LogicException("Cannot load APCu cache provider without APCu");
+ }
+
+ return new Cache\ApcuCache();
+ }
+
protected function createFilesystemCache(array $config)
{
if (empty($config['directory']))
Configuration:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Apcu';
Upvote
0