You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Oru <de...@gmail.com> on 2016/12/25 13:39:11 UTC

byte[] as a key in Ignite cache

Hi There!
I have a situation where I need to have a Java String as a key in a
distributed Ignite Cache across multiple server nodes.

I realize that strings do take double the space as compared to bytes in
java.

So it is possible or recommended to use a byte[] as a key in Ignite Cache?

What's the expert advise on this?

Thanks in advance
Debasish



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/byte-as-a-key-in-Ignite-cache-tp9728.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: byte[] as a key in Ignite cache

Posted by Oru <de...@gmail.com>.
Thanks for the reply.
I decided to use Strings with ASCII encoding.
Regards,
Oru



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/byte-as-a-key-in-Ignite-cache-tp9728p9736.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: byte[] as a key in Ignite cache

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,

Your question does not almost clear for me.

>> I realize that strings do take double the space as compared to bytes in
java.

It is not always correct. How about none latin characters?
If you are able to pack string, of course it is good idea for reduce
consume memory.

About byte[] as key, I think you will have hash code issue. You should to
implement key which will by wrapper over byte array.

On Sun, Dec 25, 2016 at 4:39 PM, Oru <de...@gmail.com> wrote:

> Hi There!
> I have a situation where I need to have a Java String as a key in a
> distributed Ignite Cache across multiple server nodes.
>
> I realize that strings do take double the space as compared to bytes in
> java.
>
> So it is possible or recommended to use a byte[] as a key in Ignite Cache?
>
> What's the expert advise on this?
>
> Thanks in advance
> Debasish
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/byte-as-a-key-in-Ignite-cache-tp9728.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov