the content management framework MODX provides the option to use APC as caching engine. I figured out that I might be able to migrate that to APCu.
I copied and edited all code so that i have a second option now that offers APCu as cache engine. As my php skills have descreased in the last years, I am struggling with the correct way to rewrite the constructor.
The original code is like this:
class xPDOAPCCache extends xPDOCache {
public function __construct(& $xpdo, $options = array()) {
parent :: __construct($xpdo, $options);
if (function_exists('apc_exists')) {
$this->initialized = true;
} else {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOAPCCache[{$this->key}]: Error creating APC cache provider; xPDOAPCCache requires the APC extension for PHP, version 2.0.0 or later.");
}
}
[...]
I rewrote that like this:
class xPDOAPCuCache extends xPDOCache {
public function __construct(& $xpdo, $options = array()) {
parent :: __construct($xpdo, $options);
if (function_exists('apcu_exists')) {
$this->initialized = true;
} else {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOAPCuCache[{$this->key}]: Error creating APCu cache provider; xPDOAPCuCache requires the APCu extension for PHP.");
}
}
[...]
That can't work, as APCu does not take the same parameters as APC did. (See http://php.net/manual/de/apciterator.construct.php and http://php.net/manual/de/apcuiterator.construct.php)
How to I need to edit this contructor to have my CMF work with APCu as cache engine?