Caching in XF2...

Jaxel

Well-known member
Below is my cache settings for XF1... how would I set this up in XF2?

Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
    'caching'                    => true,
    'lifetime'                    => 3600,
    'cache_id_prefix'            => 'calibur_'
);
$config['cache']['cacheSessions'] = true;

$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
    'compression' => false,
    'servers' => array(
        array(
            'host' => 'localhost',
            'port' => 11211,
            'persistent' => true,
            'weight' => 1,
            'timeout' => 5,
            'retry_interval' => 15,
            'status' => true,
        )
    )
);
 
Just using the default settings:
Code:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'Memcached';
$config['cache']['config'] = [
    'server' => '127.0.0.1',
];

Gives me the following error:
Code:
Fatal error: Uncaught exception 'LogicException' with message 'Cannot load Memcached cache provider without Memcached' in /src/XF/CacheFactory.php:150 Stack trace:

#0 /src/XF/CacheFactory.php(69): XF\CacheFactory->createMemcachedCache(Array)
#1 /src/XF/CacheFactory.php(24): XF\CacheFactory->instantiate('Memcached', Array)
#2 /src/XF/App.php(472): XF\CacheFactory->create('Memcached', Array)
#3 /src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 /src/XF/App.php(494): XF\Container->offsetGet('cache')
#5 /src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#6 /src/XF/App.php(1404): XF\Container->offsetGet('registry')
#7 /src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#8 /src/XF/App.php(1218): XF\Container->offse in /src/XF/CacheFactory.php on line 150
 
I can't help you more than what the manual is telling us.
Maybe write a support ticket to the staff for the problem.
 
You do have both memcache & memcached PECL's loaded via PHP?
You do have a valid memcached server running?
 
You can make sure the memcache service is up and listening:

Code:
lsof -i :11211

If it's not something like "systemctl start memcached" will get it up. You'll probably want to enable it to auto-start upon system boot with "systemctl enable memcached".

To make sure you have the PHP module something along these lines will work on cPanel:

Code:
/opt/cpanel/ea-php72/root/usr/bin/php -m |grep memcache

The above assumes you're using PHP 7.2. You'll need to change it depending upon the version of PHP you're using.
 
Top Bottom