• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 config.php memcached

MattW

Well-known member
#1
Apologies if I've missed something really obvious, but what are the settings that are needed for config.php in XF2 to enable Memcached as the back end cache?

I've tried searching, but only Redis comes up in the results.

Thanks :)
 

Chris D

XenForo developer
Staff member
#2
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'servers' => [
        ['memcached.hostname.com', 11211, 33] // host, port, weight
        // more servers
    ]
];
$config['cache']['provider'] = 'Memcached';
If it's just a single server with default port and weight etc:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'server' => 'memcached.hostname.com'
];
$config['cache']['provider'] = 'Memcached';
 
Last edited:
#3
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'servers' => [
        ['memcached.hostname.com', 11211, 33] // host, port, weight
        // more servers
    ]
];
$config['cache']['provider'] = 'Memcached';
If it's just a single server with default port and weight etc:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'server' => 'memcached.hostname.com'
];
$config['cache']['provider'] = 'Memcached';
What are configs to use multi forums on a same server with Memcached?
 

Chris D

XenForo developer
Staff member
#4
As far as I know the only way to separate memcached instances is to physically run separate instances on different ports, so you'd just use this approach:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'servers' => [
        ['memcached.hostname.com', 11212]
    ]
];
$config['cache']['provider'] = 'Memcached';
So one forum would use port 11211. Another would use 11212 etc.
 
#6
As far as I know the only way to separate memcached instances is to physically run separate instances on different ports, so you'd just use this approach:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['config'] = [
    'servers' => [
        ['memcached.hostname.com', 11212]
    ]
];
$config['cache']['provider'] = 'Memcached';
So one forum would use port 11211. Another would use 11212 etc.
Memcached is listening on one port 11211, that requires to config memcached with multi ports?
I thought we need to have a prefix in this case like on another forum software that integrated with Memcached