Record metadata
Aerospike record metadata expressions allow you to access and evaluate record-level metadata in queries.
This guide covers expressions like record_size
, key_exists
, ttl
, last_update
, and since_update
, which return details such as record size, existence, and update times. Code examples show how to use these expressions for efficient filtering and data retrieval.
Ops
device_size()
Returns the record’s storage size in bytes as an integer. Value is 0 when namespace is configured storage-engine memory
.
Note: deprecated as of Aerospike Database 7.0.
digest_modulo(mod)
Returns a record digest modulo as an integer.
is_tombstone()
Returns true
if the record is a tombstone, otherwise it returns false
.
Note: Only applies to XDR filters and when used in a write request with a read/write expressions.
key_exists()
“Returns true
if the record has a stored key, otherwise it returns false
.”
last_update()
Returns the record’s last-update-time (LUT) in nanoseconds (millisecond resolution) from Unix Epoch (1/1/1970) as an integer.
memory_size()
Starting with Database 7.0: Returns the record’s size in bytes as an integer when the namespace is configured storage-engine memory
, otherwise returns 0.
Prior to Database 7.0: Returns the record’s memory size in bytes as an integer when either the namespace is configured data-in-memory true
or storage-engine memory
, otherwise returns 0.
Note: deprecated as of Database 7.0. Use record_size
instead.
record_size()
Returns the record’s size in bytes as an integer.
set_name()
Returns the record’s set_name as a string.
string_value
Return all records where the set_name is either ‘groupA’ or ‘groupB’.
as_exp_build(predexp, as_exp_or( as_exp_cmp_eq(as_exp_set_name(), as_exp_str("groupA")), as_exp_cmp_eq(as_exp_set_name(), as_exp_str("groupB"))));
Expression exp = Exp.build(Exp.or( Exp.eq(Exp.setName(), Exp.val("groupA")), Exp.eq(Exp.setName(), Exp.val("groupB"))));
since_update()
Returns the time (in milliseconds) since the record was last updated.
ttl()
Returns the record’s TTL (Time To Live) as an integer.
void_time()
Returns the record’s expiration time in nanoseconds (resolution in seconds) as an integer.