/asked by steve neal/

Can you tell me the fastest way is to iterate through all cached values on
the local node please?

Currently I'm doing this to test the speed to iterate over 2M values:

IgniteCache<Object, String> jcache = ignite.jcache("test-cache");
AtomicInteger counter = new AtomicInteger();

long start = System.currentTimeMillis();
Iterable<Cache.Entry&lt;Object, String>> ii =
jcache.localEntries(CachePeekMode.PRIMARY);
Stream<String> timeStream = StreamSupport.stream(ii.spliterator(),
true).map((e) -> e.getValue());
timeStream.forEach((e) -> counter.incrementAndGet());

long end = System.currentTimeMillis();
log.info("time to iterate over (%s) items (%s ms)", counter.get(), (end -
start));

----- 
/This post is migrated from now discontinued Apache Ignite forum at 
http://apacheignite.readme.io/v1.0/discuss/



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Fastest-way-to-iterate-through-local-cache-values-tp59.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to