Aerospike Client APIs – Features Cheat Sheet

This was supposed to be a follow-up post to my tweet (https://twitter.com/iamontheinet/status/570378902159302656) from few weeks ago. But then I thought to myself why not make the post a little more generic and shed some light on Aerospike Client APIs in general vs writing just about the Aerospike Node.js Client. So here it is…

My Approach

I’ve taken a different approach here than merely listing the APIs. Instead, I’ve summarized them within an application context. I’ve taken application features of a Twitter-like app as an example — because it is easy to follow and most people can relate to — and mapped them to Aerospike Client APIs.

Objective

This should give you a high-level overview of some of the most important and widely used Aerospike Client APIs and how they might apply to application features.

Overview of Aerospike Client APIs:

  • Key-Value Operations
  • Secondary Indexes
  • Equality and Range Filter Queries
  • User Defined Functions (Record UDFs and Stream UDFs)
  • Aggregations

Imagine Twitter-like App…

Imagine Twitter-like App…

Imagine Twitter-like App…

Ok, I just wanted to get you in the Twitter-like App mind set before we proceed.

Here Are Some Twitter-like App Features:

  • Create User and Tweet Records
  • Retrieve User and Tweet Records
  • Update User Record
  • Query User and Tweet Records
  • Aggregate User Stats by Region

Note: To keep this post simple and within scope, I’ve omitted features such as tracking retweets, following, followers, links, mentions, etc.

Here Is How They Map To Language-Specific Aerospike Client APIs:

Create User and Tweet records

  • Put operation
Language Methods
Java put(…)
C# Put(…)
Node.js put(…)

Retrieve User record

  • Get operation
Language Methods
Java get(…)
C# Get(…)
Node.js get(…)

Retrieve Tweets for a User

  • Batch read operation OR
  • Query using Equality filter on Username
Language Methods
Java get(…)
C# Get(…)
Node.js batchGet(…)
Language Methods
Java Filter.equal(…) and query(…)
C# Filter.Equal(…) and Query(…)
Node.js filter.equal(…) and query(…)

Retrieve Tweets for all Users

  • Scan All operation
Language Methods
Java scanAll(…)
C# ScanAll(…)
Node.js query(…)

Update User record

  • Record UDF
Language Methods
Java execute(…)
C# Execute(…)
Node.js execute(…)

Retrieve Users with Tweet count between x and y

  • Secondary Index on Tweet count
  • Query using Range filter on Tweet count
Language Methods
Java createIndex(…)
C# CreateIndex(…)
Node.js createIntegerIndex(…)
Language Methods
Java Filter.range(…) and query(…)
C# Filter.Range(…) and Query(…)
Node.js filter.range(…) and query(…)

Aggregate Stats — Retrieve Users with Tweet count between x and y and aggregate Users by Region

  • Secondary Index on Tweet count
  • Query using Range filter on Tweet count
  • Stream UDF to aggregate Users based on their region
Language Methods
Java createIndex(…)
C# CreateIndex(…)
Node.js createIntegerIndex(…)
Language Methods
Java Filter.range(…) and query(…)
C# Filter.Range(…) and Query(…)
Node.js filter.range(…) and query(…)
Language Methods
Java queryAggregate(…)
C# QueryAggregate(…)
Node.js query(…)

For More Details, Examples, and Documentation — Click Here

Leave a Reply