Jamm\Memory\APCObject::add PHP Method

add() public method

Add value to memory storage, only if this key does not exists (or false will be returned).
public add ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean
$key string
$value mixed
$ttl integer
$tags array | string
return boolean
    public function add($key, $value, $ttl = 259200, $tags = NULL)
    {
        $add = apc_add($this->prefix . $key, $value, intval($ttl));
        if (!$add) {
            if (!apc_exists($this->prefix . $key)) {
                $this->ReportError('Can not add non existing key', __LINE__);
            }
            return false;
        }
        if (!empty($tags)) {
            $this->set_tags($key, $tags, $ttl);
        }
        return true;
    }