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

XF 1.4 How to enable Xenforo Backend Cache as Zend Opcache

maxicep

Active member
#1
I'm using Zend Opcache as php caching on my server side and i think Zend Opcache may use for variable caching too.

So what should be right config parameter in config.php for Xend Opcache ?

$config['cache']['backend'] => '?'

I know that we write $config['cache']['backend'] => 'xcache' while using the xcache as variable caching.

Or should i install memcache, xcache or apc for backend caching ? Thanks
 

maxicep

Active member
#3
Thank you for reply.

So whats your advice for variable caching ? We are a big board and have about ~7million posts and ~2.5million members. I was using xcache for a long time but i want to hear some advices about that if i m wrong.
 

ftsservice

Active member
#5
I know this is an old thread, but a quick FYI, since PHP 7 the opcache can be used to store variables/values, and it's exponentially faster than all the other caches since it doesn't have to serialize the data.
 

ftsservice

Active member
#7
Since 7.0 if you can use file_put_contents like this:

function cache_set($key, $val)
{
$val = var_export($val, true);
$val = str_replace('stdClass::__set_state', '(object)', $val);
// Write to temp file first to ensure atomicity
$tmp = "/tmp/$key." . uniqid('', true) . '.tmp';
file_put_contents($tmp, '<?php $val = ' . $val . ';', LOCK_EX);
rename($tmp, "/tmp/$key");
}

function cache_get($key)
{
@include "/tmp/$key";
return isset($val) ? $val : false;
}

Its blazing fast in 7+, works in prior versions but isn't fast.
 

maxicep

Active member
#8
Since 7.0 if you can use file_put_contents like this:

function cache_set($key, $val)
{
$val = var_export($val, true);
$val = str_replace('stdClass::__set_state', '(object)', $val);
// Write to temp file first to ensure atomicity
$tmp = "/tmp/$key." . uniqid('', true) . '.tmp';
file_put_contents($tmp, '<?php $val = ' . $val . ';', LOCK_EX);
rename($tmp, "/tmp/$key");
}

function cache_get($key)
{
@include "/tmp/$key";
return isset($val) ? $val : false;
}

Its blazing fast in 7+, works in prior versions but isn't fast.
What about that usage? And where?