You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Ambha <am...@wipro.com> on 2016/03/23 10:00:48 UTC

get all from IgniteCache when keys are unknown and query criteria is missing

I have a IgniteCache and need to get all the cache entries when it is not
possible to provide keys and also there is no query criteria/predicate. 

One possible solution I can think  of is to create a ScanQuery with a
IgniteByPredicate which returns true by default from apply() method. Is
there any other optimal or alternative way of achieving the same





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/get-all-from-IgniteCache-when-keys-are-unknown-and-query-criteria-is-missing-tp3633.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: get all from IgniteCache when keys are unknown and query criteria is missing

Posted by Andrey Gura <ag...@gridgain.com>.
HI,

IgniteCache implements Iterable interface. So you can just iterate
throughout all entries using for-each:

        for (Cache.Entry<Object, Object> entry : cache) {
            // do smth with entry
        }

It will be the same as using ScanQuery.

On Wed, Mar 23, 2016 at 12:00 PM, Ambha <am...@wipro.com> wrote:

> I have a IgniteCache and need to get all the cache entries when it is not
> possible to provide keys and also there is no query criteria/predicate.
>
> One possible solution I can think  of is to create a ScanQuery with a
> IgniteByPredicate which returns true by default from apply() method. Is
> there any other optimal or alternative way of achieving the same
>
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/get-all-from-IgniteCache-when-keys-are-unknown-and-query-criteria-is-missing-tp3633.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com