XF 2.1 Memcached for guest page caching?

jb-net

Active member
Hi,

I'm currently using Memcached for the default xenforo caching:

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

I now also want to enable Guest page caching with $config['pageCache']['enabled'] = true;

No I'm wondering what should I do:
a) just add $config['pageCache']['enabled'] = true; and using the same Memcached
b) a different kind of cache for the Guest page caching
c) a second instance of Memcached on a different port?
d) just a different namespace within Memcached?

Thanks,
jb-net
 
The risk of using a shared cache instance for page caching is that it can trigger a lot of cache data which means that other cache data may be pushed out. If you use caching for sessions (which if you're talking about page caching, you probably would be), this could lead to sessions being evicted from the cache too early.

If your Memcached instance has enough memory that you're sure sessions wouldn't be evicted prematurely, then you could use the same instance (though you would still need to configure the page cache instance explicitly as it's disabled unless you do that). However, otherwise, you might need to setup a second Memcached instance or use another cache system (such as Redis; I wouldn't bother with something like the filesystem cache for page caching). A separate cache namespace wouldn't really be sufficient as you would just be pulling from the same limited memory; namespaces just prevent collisions.
 
Hi Mike,

thanks a lot for your reply (y) I now sucessfully set up two independent memcached instances and edited the Xenforo config.php:
Code:
$config['cache']['enabled'] = true;
$config['cache']['css']['enabled'] = true; 
$config['cache']['provider'] = 'Memcached';
$config['cache']['config'] = [
    'server' => '127.0.0.1',
    'port' => '11211'
];
$config['pageCache']['enabled'] = true;
$config['pageCache']['lifetime'] = 180;
$config['cache']['context']['page']['provider'] = 'Memcached';
$config['cache']['context']['page']['config'] = [
    'server' => '127.0.0.1',
    'port' => '11212'
];

While the first cache works perfectly fine (read/writes/hits all as expected) the second cache for the pageCache stays empty (I checked and can confirm he is up and running under port 11212) with no error messages.

Did I make a mistake in the config.php?
 
I'm not seeing anything jumping out to me as wrong -- it's pretty much as the manual recommends. Only thing that comes to mind is a delay in the change being applied due to PHP's opcache configuration? (Or it entirely ignoring changes because it's not checking for FS changes.)
 
Back
Top Bottom