I'm new to Aerospike and am probably missing something fundamental, but I'm trying to see an enumeration of the Keys
in a Set
(I'm purposefully avoiding the word "list" because it's a datatype).
For example,
Namespaces
, the docs say to use SHOW NAMESPACES
Sets
, we can use SHOW SETS
If I want to see all the unique Keys
in a Set
... what command can I use?
It seems like one can use client.scan()
... but that seems like a super heavy way to get just the key (since it fetches all the bin data as well).
Any recommendations are appreciated! As of right now, I'm thinking of inserting (deleting) into (from) a meta-record.
Thank you @pgupta for pointing me in the right direction.
This actually has two parts:
put()
calls -- set policy to save the key value server-side (otherwise, it seems only a digest/hash is stored?). Here's an example in Python:
aerospike_client.put(key, {'bin': 'value'}, policy={'key': aerospike.POLICY_KEY_SEND})
Example:
keys = []
scan = client.scan('namespace', 'set')
scan_opts = { 'concurrent': True, 'nobins': True, 'priority': aerospike.SCAN_PRIORITY_MEDIUM }
for x in (scan.results(policy=scan_opts)): keys.append(x[0][2])
The need to iterate over the result still seems a little clunky to me; I still think that using a 'master-key' Record to store a list of all the other keys will be more performant, in my case -- in this way, I can simply make one get()
call to the Aerospike server to retrieve the list.