I’ve started building an AS-based POC as a replacement for Cassandra, but stuck with pagination (user posts with an infinite scroll).
To be fair - there are a lot of places already discussing pagination (people asking either for offset/limit or cursor implementation), however all answers are actually workarounds with their disadvantages, rather than pointers to “official” function/implementation, for example - using LLIST.
Please advise,
is it just my misunderstanding of AS’s goal and its just not meant to be used in pagination scenarios working more like an advanced version of redis,
or there is actually a correct/native/official way to provide pagination like offset,limit of MySQL or pagestate in Cassandra (maybe using UDFs)?
If latter, could you please provide a link to documentation (ideally, of the Go driver) describing the approach?
the discussion here is more about how to handle the specific use-case here of time-based events.
Correction: the use-case in discussion is not for time-based events, rather - about a fixed amount of items to be returned.
Regarding LDT/LLIST:
I’m new to AS so please correct me if I’m wrong, but I cannot get rid of impression that LLIST approach comes down to:
Creating a dedicated set
That set will have 1 row
That row will have an LLIST-type bin, for example, post_index
post_index will be a list of actual post IDs, sorted by creation desc (if supported), that I will be able to use doing classic pagination (cursor, preferred, or an offset/limit).
If all above is correct, then questions:
This is definitely a workaround, i.e. something not inherently native to AS.
What disadvantages I should expect?
Hi I am having the same problem , I have a “products” set which contains many products , I have a timestamp bin in the “products” set , what I need to do is to implement a query something like “Get the next 10 products from the current timestamp” , so can anyone suggest me any technique or method using which I can achieve my goal, Any help would be appreciated…
Currently there’s the approach of keeping the IDs in a List or Map and paginating on them with the native List and Map API methods, as Piyush suggested. It’s not ideal, but it’s functional enough as a workaround.
In upcoming versions of Aerospike there will be a way to scan and query with the ability to get several records at a time, optionally starting at the specific digest. You’ll implement pagination using that feature, asking for N records and then for another batch of N starting with the digest of the last record you got.