-
Notifications
You must be signed in to change notification settings - Fork 28
Examples
The Aerospike PHP client package includes example scripts that demonstrate the features of the PHP extension.
The examples have a similar interface viewed by calling the example with the --help
flag. These examples access an Aerospike server with the IP address 192.168.119.3
.
There are more basic examples here.
rec-operations.php
has examples of record-level operations (such as get()
, remove()
, touch()
, exists()
, and put()
) with various policy options set (Aerospike::OPT\_POLICY\_GEN
, Aerospike::OPT\_POLICY\_EXISTS
), and an example of record identification using its digest (the hash key on the server).
php rec-operations.php --host=192.168.119.3 -a -c
batch-operations.php
has example batch record operations getMany()
and existsMany()
.
php batch-operations.php --host=192.168.119.3 -a -c
bin-operations.php
has example record bin modification operations such as prepend()
, append()
, increment()
, operate()
(multi-ops), and removeBin()
.
php bin-operations.php --host=192.168.119.3 -a -c
The example in udf-operations.php
applies two Record User-Defined Functions (UDFs) to a record bin.
php udf-operations.php --host=192.168.119.3 -a -c
This section describes the scan method examples here.
The standard.php
example invokes a callback method for each record streamed from the server as it scans the users set in the test
namespace.
php standard.php --host=192.168.119.3 -a -c
buffered.php
demonstrates buffering the records streaming back from a scan into a $result
array, and stopping the scan by returning false
at the specified expiration limit.
php buffered.php --host=192.168.119.3 -a -c
background.php
demonstrates applying a UDF to each record in a background scan of set users in namespace test, transforming the record age bin value, and displaying the records.
php background.php --host=192.168.119.3 -a -c
This section describes the query examples here.
simple.php
invokes a callback method for each record streamed from the server as it queries the characters set in the test
namespace, creates a secondary index on a bin in this set.
php simple.php --host=192.168.119.3 -a -c
aggregate.php
applies UDF aggregation (similar to SQL COUNT(*) GROUP BY _field_
) to records streaming out of a secondary index query.
php aggregate.php --host=192.168.119.3 -a -c
This section describes the info examples here.
standard.php
demonstrates the info()
, infoMany()
, and getNodes()
info methods.
php standard.php --host=192.168.119.3 -a
PHP Client