Quasardb API for PHP
Introduction Installation Compilation Configuration API Reference

Namespaces

  • qdb

Classes

  • QdbAliasAlreadyExistsException
  • QdbAliasNotFoundException
  • QdbBatch
  • QdbBatchResult
  • QdbBlob
  • QdbCluster
  • QdbConnectionException
  • QdbContainerEmptyException
  • QdbDeque
  • QdbEntry
  • QdbEntryCollection
  • QdbException
  • QdbExpirableEntry
  • QdbIncompatibleTypeException
  • QdbInputException
  • QdbInteger
  • QdbOperationDisabledException
  • QdbOperationException
  • QdbProtocolException
  • QdbSystemException
  • QdbTag
  • QdbTagCollection

Class QdbInteger

A signed 64-bit integer in the database.

qdb\QdbEntry
Extended by qdb\QdbExpirableEntry
Extended by qdb\QdbInteger
Namespace: qdb
Example:

You get a QdbInteger instance by calling \QdbCluster::integer(). Then you can perform atomic operations on the integer:

$cluster->integer('key 0')->put(1);
$cluster->integer('key 1')->update(2);
$value2 = $cluster->integer('key 2')->get();

Methods summary
public integer
# add( integer $value )

Atomically increment the value in the database.

Atomically increment the value in the database.

Parameters

$value
The value to add to the integer.

Returns

integer
The new value (i.e. after the addition) of the integer.

Throws

qdb\QdbAliasNotFoundException
qdb\QdbIncompatibleTypeException

Example

$total = $cluster->integer('alias')->add(42);
public integer
# get( )

Reads the integer's value.

Reads the integer's value.

Returns

integer
The value of the integer.

Throws

qdb\QdbAliasNotFoundException
qdb\QdbIncompatibleTypeException

Example

$value = $cluster->integer('alias')->get();
public
# put( integer $value, integer $expiry_time = 0 )

Creates the integer, fails if it already exists.

Creates the integer, fails if it already exists.

Parameters

$value
The initial value of the integer.
$expiry_time
The absolute expiration time, in seconds since epoch (0 means "never expires").

Throws

qdb\QdbAliasAlreadyExistsException
qdb\QdbIncompatibleTypeException

Example

$cluster->integer('alias')->put(42);
public boolean
# update( integer $value, integer $expiry_time = 0 )

Sets the integer's value. Creates the integer if needed.

Sets the integer's value. Creates the integer if needed.

Parameters

$value
The new value of the integer.
$expiry_time
The absolute expiration time, in seconds since epoch (0 means "never expires").

Returns

boolean
true if the integer was created; false if it was updated.

Throws

qdb\QdbIncompatibleTypeException

Example

$cluster->integer('alias')->update(42);
Methods inherited from qdb\QdbExpirableEntry
expiresAt(), expiresFromNow(), getExpiryTime()
Methods inherited from qdb\QdbEntry
alias(), attachTag(), attachTags(), detachTag(), getTags(), hasTag(), remove()
Copyright 2009-2018 quasardb SAS Documentation generated by ApiGen