Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.21 KB

apiref_connection.md

File metadata and controls

58 lines (45 loc) · 1.21 KB

Lifecycle and Connection Methods

public int Aerospike::__construct ( array $config [, boolean $persistent_connection = true [, array $options]] )
public void Aerospike::__destruct ( void )
public boolean Aerospike::isConnected ( void )
public void Aerospike::close ( void )
public void Aerospike::reconnect ( void )

Aerospike::getNodes [to be implemented]

public int Aerospike::getNodes ( array &$metadata [, array $options ] )

Example

<?php

$config = array("hosts"=>array(array("addr"=>"192.168.1.10", "port"=>3000)));
$db = new Aerospike($config, false);
if (!$db->isConnected()) {
   echo "Aerospike failed to connect[{$db->errorno()}]: {$db->error()}\n";
   exit(1);
}

$res = $db->getNodes($node_metadata);
if ($res == Aerospike::OK) {
    var_dump($node_metadata);
} else {
    echo "[{$db->errorno()}] ".$db->error();
}

$db->close();
$db->reconnect();
$db->__destruct();

?>