Rethinkdb::IO

This module handles communicating with the RethinkDB Database.

package MyApp;
use Rethinkdb::IO;

my $io = Rethinkdb::IO->new->connect;
$io->use('marvel');
$io->close;

ATTRIBUTES

Rethinkdb::IO implements the following attributes.

host

my $io = Rethinkdb::IO->new->connect;
my $host = $io->host;
$io->host('r.example.com');

The host attribute returns or sets the current host name that Rethinkdb::IO is currently set to use.

port

my $io = Rethinkdb::IO->new->connect;
my $port = $io->port;
$io->port(1212);

The port attribute returns or sets the current port number that Rethinkdb::IO is currently set to use.

default_db

my $io = Rethinkdb::IO->new->connect;
my $port = $io->default_db;
$io->default_db('marvel');

The default_db attribute returns or sets the current database name that Rethinkdb::IO is currently set to use.

auth_key

my $io = Rethinkdb::IO->new->connect;
my $port = $io->auth_key;
$io->auth_key('setec astronomy');

The auth_key attribute returns or sets the current authentication key that Rethinkdb::IO is currently set to use.

timeout

my $io = Rethinkdb::IO->new->connect;
my $timeout = $io->timeout;
$io->timeout(60);

The timeout attribute returns or sets the timeout length that Rethinkdb::IO is currently set to use.

METHODS

Rethinkdb::IO inherits all methods from Rethinkdb::Base and implements the following methods.

connect

my $io = Rethinkdb::IO->new;
$io->host('rdb.example.com');
$io->connect->repl;

The connect method initiates the connection to the RethinkDB database.

close

my $io = Rethinkdb::IO->new;
$io->host('rdb.example.com');
$io->connect;
$io->close;

The connect method closes the current connection to the RethinkDB database.

reconnect

my $io = Rethinkdb::IO->new;
$io->host('rdb.example.com');
$io->connect;
$io->reconnect;

The reconnect method closes and reopens a connection to the RethinkDB database.

repl

my $io = Rethinkdb::IO->new;
$io->host('rdb.example.com');
$io->connect->repl;

The repl method caches the current connection in to the main program so that it is available to for all Rethinkdb queries without specifically specifying one.

use

my $io = Rethinkdb::IO->new;
$io->use('marven');
$io->connect;

The use method sets the default database name to use for all queries that use this connection.

noreply_wait

my $io = Rethinkdb::IO->new;
$io->noreply_wait;

The noreply_wait method will tell the database to wait until all “no reply” have executed before responding.

server

my $conn = r->connect;
$conn->server;

Return information about the server being used by this connection.

The server command returns either two or three fields:

  • id: the UUID of the server the client is connected to.
  • proxy: a boolean indicating whether the server is a RethinkDB proxy node.
  • name: the server name. If proxy is r->true, this field will not be returned.

SEE ALSO

Rethinkdb, http://rethinkdb.com