There are a number of ways to tackle this. If your cache split the key into distinct fields rather that a concatenated string, you could SQL-enable your cache and get your count as a simple SELECT statement.
Alternatively, there’s an affinity compute task that takes a partition (affinityCallAsync <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteCompute.html#affinityCallAsync-java.util.Collection-int-org.apache.ignite.lang.IgniteCallable->). If you use that and a ScanQuery that fetches records from a specific partition (ScanQuery <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/query/ScanQuery.html#ScanQuery-int->), you’ll get something like a map-reduce. (You could also use the map-reduce API, but an affinity call is probably easier.) > On 24 Aug 2022, at 11:59, [email protected] wrote: > > hi > do I pass cache in distribute compute than use cache scan ,that faster than I > use a cache scan in client api. > > ---Original--- > From: "[email protected]"<[email protected]> > Date: Wed, Aug 24, 2022 17:06 PM > To: "user"<[email protected]>; > Subject: count cache key number > > Hi, > I have a cache ,it's key like > "mobile:140000" > "mobile:140001", > "address:test1", > "address:test2", > "address:test3"。 > I want to count mobile number and address number。 > address number is 3 and mobile number is 2。I see Ignite doc has mapreduce > job,but it seem not example iterator cache key。 is there any method to > iterator key in mapreduce job。Thank you very much > > [email protected]
