I've encounter a problem with PHP to store intermediate result locally.
With APC
:
apc_store("foo", "bar");
$ret = apc_fetch("foo");
With APCu
:
apcu_store("foo", "bar", 0);
$ret = apcu_fetch("foo");
I store with apc_store/apcu_store under php_cli on a php script, and fetch with apc_fetch/apcu_fetch on another php script, and find the $ret
to be empty.
While, with shmop
:
$shmKey = ftok(__FILE__, 't');
$shmId = shmop_open($shmKey, "c", 0644, 1024);
$dataArray = array("foo" => "bar");
shmop_write($shmId, serialize($dataArray), 0);
$retArray = unserialize(shmop_read($shmId, 0, shmop_size($shmId)));
$ret = $retArray['foo'];
Here I get the $ret
: "bar"
.
Shouldn't the APC/APCu
cache the intermediate result locally just as the shmop
?