I don't understand your requirement.
What you mean by random? You can't get data from the cache without knowing the key
I need to do something like this:
but ideally in a more efficient way... Thank for any suggestion!
I still don't understand the purpose.
As I said you can't get a value without knowing the key.
If you have such requirement you might add a special entry as cursor and store soemthing like 'first, last, current' and link the key-value objects in the case with additional information previous-next.
Does that makes sense to you?
I am building an application that uses the "query-by-example" paradigm and, in general, I need the data object to issue a query. The key-value store maintains data objects based on their unique IDs (ID-object) and, mainly for testing purposes, I need to access a random sample of the stored data. Of course I could build some additional indexing structure that would allow a "random" access to the IDs (either using the K-V store or outside) but I was thinking that may be I could somehow access the local hash-table of Ispn node and implement this operation directly.