Iterator for keys only ?

classic Classic list List threaded Threaded
3 messages Options
Mikael Mikael
Reply | Threaded
Open this post in threaded view
|

Iterator for keys only ?

Hi!

What is the best way to iterate over the keys only from a cache ? I
don't want the values because these are long text strings so will slow
down the iterator a lot.

Pretty much the Ignite way of doing map.keySet().iterator();

Mikael


Alexandr Shapkin Alexandr Shapkin
Reply | Threaded
Open this post in threaded view
|

RE: Iterator for keys only ?

Hello!

 

You can try to use SqlFieldsQuery with “select _key from [CacheTable]” for that.

 

From: [hidden email]
Sent: Wednesday, September 11, 2019 3:47 PM
To: [hidden email]
Subject: Iterator for keys only ?

 

Hi!

 

What is the best way to iterate over the keys only from a cache ? I

don't want the values because these are long text strings so will slow

down the iterator a lot.

 

Pretty much the Ignite way of doing map.keySet().iterator();

 

Mikael

 

 

 

Alex Shapkin
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Iterator for keys only ?

In reply to this post by Mikael
Hello!

You can also use ScanQuery with Transformer. Note that all key-value pairs will still be deserialized. If your key fits in index, it would indeed be better to use SQL.

Regards,
--
Ilya Kasnacheev


ср, 11 сент. 2019 г. в 15:47, Mikael <[hidden email]>:
Hi!

What is the best way to iterate over the keys only from a cache ? I
don't want the values because these are long text strings so will slow
down the iterator a lot.

Pretty much the Ignite way of doing map.keySet().iterator();

Mikael