Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.01 KB

apiref_connection.md

File metadata and controls

51 lines (39 loc) · 1.01 KB

Lifecycle and Connection Methods

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

Example

<?php

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

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

?>