...
 
Commits (2)
......@@ -35,6 +35,21 @@ class TransientCache
return $this->data;
}
public function Cache($key, $valueGetter, $params = null)
{
if (!is_callable($valueGetter))
trigger_error('$valueGetter needs to be callable.', E_USER_ERROR);
if (($result = $this->Get($key)) !== false)
return $result;
$result = call_user_func_array($valueGetter, $params);
$this->Set($key, $result);
return $result;
}
public static function Load($name)
{
// litter pointless empty objects if disabled
......