CacheTool\Proxy\ApcuProxy::apcu_dec PHP Method

apcu_dec() public method

Decrease a stored number
Since: 3.1.1
public apcu_dec ( string $key, integer $step = 1, stdClass $ref = false ) : mixed
$key string The key of the value being decreased.
$step integer The step, or value to decrease.
$ref stdClass success is set to TRUE in success and FALSE in failure
return mixed Returns the current value of key's value on success, or FALSE on failure
    public function apcu_dec($key, $step = 1, $ref = false)
    {
        $code = new Code();
        $code->addStatement('$success = false;');
        $code->addStatement(sprintf('$result = apcu_dec(%s, %s, $success);', var_export($key, true), var_export($step, true)));
        $code->addStatement('return array($result, $success);');
        list($result, $success) = $this->adapter->run($code);
        if (is_object($ref)) {
            $ref->success = $success;
        }
        return $result;
    }