Skip to content

Setup

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

Verify database is running

This tutorial requires that Aerospike database is running. Before starting the examples below, verify this from a terminal with asinfo (part of the Aerospike Tools package), for example asinfo -v status.

Download and install additional components

Install the Aerospike client for your preferred language in a version with support for expressions.

Add the Aerospike Java client to your project’s Maven pom.xml:

<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client</artifactId>
<version>10.4</version>
</dependency>
</dependencies>

Initialize client

Initialize the client. Also, define constants including the namespace test and set expressions and a convenient function truncateTestData.

import com.aerospike.client.AerospikeClient;
AerospikeClient client = new AerospikeClient("localhost", 3000);
System.out.println("Initialized the client and connected to the cluster.");
final String NAMESPACE = "test";
final String SET_NAME = "expressions";
// convenience functions to truncate test data
void truncateTestData() {
try {
client.truncate(null, NAMESPACE, SET_NAME, null);
}
catch (AerospikeException e) {
// ignore
}
}

Output:

Initialized the client and connected to the cluster.

Access shell commands

You may execute shell commands including Aerospike tools such as aql and asadm from a terminal throughout this tutorial.

Next

Continue to Understanding expressions.