fbpx

How to enable caching on XenForo

XenForo recommends defining a cache for larger installations, as it can save on processing time and database queries. It can be configures in your src/config.php file.

Supported providers

These are the most popular XenForo cache providers:

  • APC
  • File system cache
  • Memcached
  • Redis
  • WinCache
  • XCache

Many of the cache providers will require software to be explicitly installed on your server. You may wish to inquire with your host as to which options are available.

APC

To configure APC, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'ApcCache';

File system cache

To configure File system cache, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Filesystem';
$config['cache']['config'] = [
    'directory' => '/path/to/your/cache/directory'
];

Memcached

To configure Memcached, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Memcached';
$config['cache']['config'] = [
    'server' => '127.0.0.1'
];

It is also possible to configure an array of servers, if required.

Redis

To configure Redis, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
    'host' => '127.0.0.1',
    'password' => 'password'
];

Redis has a number of additional configuration options. The following list will demonstrate the default values of all of the supported configuration items available:

'host' => '',
'port' => 6379,
'timeout' => 0.0,
'password' => '',
'database' => 0,
'persistent' => false,
'persistent_id' => ''

WinCache

To configure WinCache, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'WinCache';

XCache

To configure XCache, add the following snippet of code to your src/config.php file.

$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'XCache';

If you are a Host Duplex customer and still have questions, please open a ticket in the Host Duplex client portal.

Updated on November 1, 2021

Was this article helpful?

Related Articles

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.