Fixed The same caching context's caching provider can be created twice

Xon

Well-known member
Affected version
2.3 Beta 1
This will cause the main cache section to be created twice:
PHP:
\XF::app()->cache('', false, true);
\XF::app()->cache('', false, false);

When using redis of memcache, this means multiple TCP sessions will be created (which may be SSL and require username/password authentication)

This is because of the following code:

PHP:
$key = $context;
if ($doctrineCompatible)
{
    $key .= '_doctrine';
}

$cache = $this->container->create('cache', $key, [
    'doctrineCompatible' => $doctrineCompatible
]);

The cache key changes despite having the same configuration.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.0 Beta 2).

Change log:
Re-use the Symfony adapter when decorating cache adapters with the Doctrine compatibility shim
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom