-
Notifications
You must be signed in to change notification settings - Fork 29
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 -cbatch-operations.php has example batch record operations getMany() and existsMany().
php batch-operations.php --host=192.168.119.3 -a -cbin-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 -cThe 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 -cThis 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 -cbuffered.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 -cbackground.phpdemonstrates 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 -cThis 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 -caggregate.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 -cThis section describes the info examples here.
standard.php demonstrates the info(), infoMany(), and getNodes() info methods.
php standard.php --host=192.168.119.3 -aPHP Client