TokyoTyrant::add
TokyoTyrant::connectUri
TokyoTyrant
PHP Manual

# TokyoTyrant::connect

Connect to a database

### Description

public TokyoTyrant TokyoTyrant::connect ( string `$host` [, int `$port` = TokyoTyrant::RDBDEF_PORT [, array `$options` ]] )

Connects to a remote database

### Parameters

`host`

  The hostname

`port`

  The port. Default: 1978

`options`

  Connection options: timeout (default: 5.0), reconnect (default: `TRUE`) and persistent (default: `TRUE`)

### Return Values

This method returns the current object and throws TokyoTyrantException on failure.

### Examples

Example #1 TokyoTyrant::connect example

`<?php
$tt = new TokyoTyrant();
$tt->connect("localhost", TokyoTyrant::RDBDEF_PORT)->put("test", "value");
?>`

### See Also

- TokyoTyrant::connectUri