-
1. Re: Get random object from cache
wdfink Jul 3, 2014 3:28 PM (in response to david.novak)I don't understand your requirement.
What you mean by random? You can't get data from the cache without knowing the key
-
2. Re: Get random object from cache
david.novak Jul 4, 2014 3:27 AM (in response to wdfink)I need to do something like this:
return cache.get(cache.keySet().iterator().next());
but ideally in a more efficient way... Thank for any suggestion!
-
3. Re: Get random object from cache
wdfink Jul 4, 2014 10:08 AM (in response to david.novak)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?
-
4. Re: Get random object from cache
david.novak Jul 7, 2014 9:45 AM (in response to wdfink)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.