You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by vkulichenko <va...@gmail.com> on 2017/06/09 17:36:05 UTC

Re: How to operate with cache<*Key, *> or cache,*>?

Hi,

Please properly subscribe to the mailing list so that the community can
receive email notifications for your messages. To subscribe, send empty
email to user-subscribe@ignite.apache.org and follow simple instructions in
the reply.


Artёm Basov wrote
> Lets take example from 
> https://apacheignite.readme.io/docs/affinity-collocation
> <https://apacheignite.readme.io/docs/affinity-collocation>  
>  with Person, Company and PersonKey classes.
> 
> Lets say i want to remove persons by their ids (cache.removeAll(...)) but
> since i don't know companyId i can't create proper PersonKey.
> 
> Is there a better way, than this:
> QueryCursor
> <PersonKey>
>  cursor = personCache.query(new ScanQuery&lt;PersonKey, Person&gt;((k, v)
> -> k.getPersonId().equals("myPersonId1")), Cache.Entry::getKey);
> personCache.removeAll(new HashSet<>(cursor.getAll()));

You can use SQL DELETE for this: https://apacheignite.readme.io/docs/dml

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-operate-with-cache-Key-or-cache-AffinityKey-tp13561p13576.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to operate with cache<*Key, *> or cache,*>?

Posted by Artёm Basov <ba...@gmail.com>.
Hi, Valentine.

Thanks for your response! It's a shame i overlooked DML.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-operate-with-cache-Key-or-cache-AffinityKey-tp13561p13642.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.