Not a bug Cannot use APCu caching without APC-BC

Affected version
2.1RC2
This is a php-specific issue, not a XenForo one. As of PHP 7+ you need the BC module to use APCu.
 
Well, can I use XenForo without PHP? I don't think so, so a PHP issue is a XenForo issue then.
And it's not even PHP version-specific either, since PHP 5 is EOL already, there is no other PHP than 7+.

Now that aside, BC stands for "backwards-compatible". Since we established that PHP 5 is obsolete (EOL), and you just that XenForo with PHP7+ requires APCu-BC, then it means that XenForo is relying on backwards compatibility to an obsolete interface. That makes XenForo at fault.

Let's consider the history of APC and what APCu is. APC doesn't exist in PHP 7+ because opcache took over the bytecode caching and APCu was spawned to provide only the "user caching" part of what old APC did. Thus, there's no APC in PHP7+ world. And there's no other PHP than PHP 7+.

Now, this is all a moot issue, since XenForo is not actually directly using APC (or APCu) but through Doctrine\Common\Cache. Since XenForo has its own way of selectively exposing some Cache classes and not others, NOT exposing Doctrine\Common\Cache\Apcu is a bug that is ridiculously easy to fix.

I hope an actual developer can read this issue and include the simple fix that I posted in https://xenforo.com/community/threa...-cache-apcu-for-xf-cache.159937/#post-1318268
@Mike @Chris D
 
Last edited:
While not a bug, it is a reasonable suggestion, but it is something you can implement yourself for now if you wish to, without changing the XF code.

The CacheFactory is capable of instantiating cache providers via a closure defined in src/config.php. So you don't need to invalidate any file hashes at all, you just add the following to the config file:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = function()
{
    return new \Doctrine\Common\Cache\ApcuCache();
};
We'll consider changes in the future, but in the meantime the system was designed in this way specifically for the purpose of being able to configure other cache providers that we don't support out of the box if you want to.
 
Thank you, at least that's a clean solution without invalidating file hashes - just like you said.

When considering a permanent solution, it would be best to auto-detect in XF whether apc_fetch or apcu_fetch is available to simplify the configuration.
 
Back
Top Bottom