Skip to content
Webinar - May 13th: How Criteo powers real-time decisions with a reduced footprintRegister now

Read

Use Aerospike Ruby client #get APIs to:

  • Read all record bins.
  • Read only specified record bins.
  • Read only the record metadata.
  • Check existence of a record.

Each method returns a Record object containing the specified record metadata and bins.

See Batch Reads to learn how to read multiple records in the same call.

Reading All Record Bins

Use #get to read all record bins. This reads the record and metadata from the database and returns a Record object.

To read all record bins:

record = client.get(key)

Reading Specific Record Bins

Use #get and specify each bin to read specific bins of a record. This reads the record metadata and returns a Record object containing the specified bins.

This example reads the name and age bins from the record:

record = client.get(key, ['name', 'age'])

Checking Record Existence

To check that a record exists using #exists:

exists = client.exists(key)

A batch request for existence is also available.

The result array returns in the same order as the key array:

keys = []
for i in 0...size do
keys << Key.new('test', 'myset', (i + 1))
end
existsArray = client.batch_exists(keys)
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?