This repository was archived by the owner on Jan 29, 2020. It is now read-only.
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
Idea: add getItemWithCallback method #49
Open
Description
Implementation could looks like
function getItemWithCallback($key, $callback) {
$item = $this->getItem($key);
if ($item === false) {
$item = $callback($key);
$this->setItem($key, $item);
}
return $item;
}
And with APCu 5.1, this can be override to use new "apcu_entry" API which will manage a lock to avoid bad run race condition, and a single execution of the callback.