Class QdbCluster
A connection to a quasardb cluster.
Namespace: qdb
Example:
$cluster = new QdbCluster('qdb://127.0.0.1:2836');
$cluster->blob('key 0')->put('value 0');
$cluster->deque('key 1')->pushBack('value 1');
$cluster->integer('key 2')->add(42);
Methods summary
public
|
#
__construct( string $uri )
Connects to a quasardb cluster through the specified URI.
Connects to a quasardb cluster through the specified URI.
The URI contains the addresses of the bootstraping nodes, other nodes are discovered during the first connection.
Having more than one node in the URI allows to connect to the cluster even if the first node is down.
Parameters
- $uri
- A quasardb URI, in the form of
qdb://<address1>:<port1>[,<address2:<port2>...].
Throws
QdbConnectionRefusedException
QdbTimeoutException
Example
$cluster = new QdbCluster('qdb://127.0.0.1:2836');
|
public
qdb\QdbBlob
|
#
blob( string $alias )
Creates a qdb\QdbBlob associated with the specified alias.
Creates a qdb\QdbBlob associated with the specified alias.
No query is performed at this point.
Parameters
- $alias
- The alias of the blob (alias starting with
qdb are reserved).
Returns
Example
$cluster->blob('alias')->put('content');
|
public
qdb\QdbDeque
|
#
deque( string $alias )
Creates a qdb\QdbDeque associated with the specified alias.
No query is performed at this point.
Parameters
- $alias
- The alias of the queue (alias starting with
qdb are reserved).
Returns
Example
$cluster->deque('alias')->pushBack('content');
|
public
qdb\QdbEntry
|
#
entry( string $alias )
Create a qdb\QdbBlob, a qdb\QdbDeque, a qdb\QdbInteger or a qdb\QdbTag
depending on the actual type of the entry.
The entry must exist in the database.
Parameters
- $alias
- The alias of the entry (alias starting with
qdb are reserved).
Returns
Throws
qdb\QdbAliasNotFoundException$entry1 = $cluster->entry('alias1'); // $entry1 is a QdbBlob
$entry2 = $cluster->entry('alias2'); // $entry2 is a QdbDeque
Example
$cluster->blob('alias1')->put('content');
$cluster->deque('alias2')->pushBack('content');
|
public
qdb\QdbInteger
|
#
integer( string $alias )
Creates a qdb\QdbInteger associated with the specified alias.
No query is performed at this point.
Parameters
- $alias
- The alias of the integer (alias starting with
qdb are reserved).
Returns
Example
$cluster->integer('alias')->update(42);
|
public
|
#
purgeAll( integer $timeout = 300 )
Removes all the entries on all the nodes of the quasardb cluster.
Removes all the entries on all the nodes of the quasardb cluster.
This operation is not allowed by default, it must be enabled in the server configuration.
Parameters
- $timeout
- The maximim number of seconds for the command to execute.
Throws
Example
$cluster->purgeAll();
|
public
qdb\QdbBatchResult
|
#
runBatch( qdb\QdbBatch $batch )
Executes operations of a QdbBatch.
Executes operations of a QdbBatch.
Parameters
Returns
Example
$batch = new QdbBatch();
$batch->put('alias1', 'content1');
$batch->put('alias2', 'content2');
$cluster->runBatch($batch);
|
public
qdb\QdbTag
|
#
tag( string $alias )
Creates a qdb\QdbTag associated with the specified alias.
Creates a qdb\QdbTag associated with the specified alias.
No query is performed at this point.
Parameters
- $alias
- The alias of the tag (alias starting with
qdb are reserved).
Returns
Example
$taggedEntries = $cluster->tag('alias')->getEntries();
|