Hi Michael,

The troubles could be related to Python library. It seems in Python 2.7
there is no such thing as "byte array". And value passed to the client is
string in this case.
I checked that Ignite recognizes bytes array type and stores in as byte
array internally. I did following experiment with Spymemcached [1].
public class Memcached {
    public static void main(String[] args) throws IOException {
        MemcachedClient client = new MemcachedClient(
            new BinaryConnectionFactory(),
            AddrUtil.getAddresses("127.0.0.1:11211"));

        client.add("a", Integer.MAX_VALUE, new byte[]{1, 2, 3});
        client.add("b", Integer.MAX_VALUE, "123");

        System.out.println(Arrays.toString((byte[])client.get("a")));
        System.out.println(client.get("b"));

        System.exit(0);
    }
}

And I see expected output:
[1, 2, 3]
123

[1] https://mvnrepository.com/artifact/net.spy/spymemcached/2.12.3

ср, 17 окт. 2018 г. в 10:25, Павлухин Иван <vololo...@gmail.com>:

> Hi Michael,
>
> Answering one of your questions.
> > Does ignite internally have a way to store the data type when cache
> entry is stored?
> Yes, internally Ignite maintains data types for stored keys and values.
>
> Could you confirm that for real memcached your example works as expected?
> I will try reproduce your Python example. It should not be hard to check
> what exactly is stored inside Ignite.
>
> ср, 17 окт. 2018 г. в 5:25, Michael Fong <mcfong.o...@gmail.com>:
>
>> bump :)
>>
>> Could anyone please help to answer a newbie question? Thanks in advance!
>>
>> On Mon, Oct 15, 2018 at 4:22 PM Michael Fong <mcfong.o...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I kind of able to reproduce it with a small python script
>>>
>>> import pylibmc
>>>
>>> client = pylibmc.Client (["127.0.0.1:11211"], binary=True)
>>>
>>>
>>> ##abc
>>> val = "abcd".decode("hex")
>>> client.set("pyBin1", val)
>>>
>>> print "val decode w/ iso-8859-1: %s" % val.encode("hex")
>>>
>>> get_val = client.get("pyBin1")
>>>
>>> print "Value for 'pyBin1': %s" % get_val.encode("hex")
>>>
>>>
>>> where the the program intends to insert a byte[] into ignite using
>>> memcache binary protocol.
>>> The output is
>>>
>>> val decode w/ iso-8859-1: abcd
>>> Value for 'pyBin1': *efbfbdefbfbd*
>>>
>>> where, 'ef bf bd' are the replacement character for UTF-8 String.
>>> Therefore, the value field seems to be treated as String in Ignite.
>>>
>>> Regards,
>>>
>>> Michael
>>>
>>>
>>>
>>> On Thu, Oct 4, 2018 at 9:38 PM Maxim.Pudov <pudov....@gmail.com> wrote:
>>>
>>>> Hi, it looks strange to me. Do you have a reproducer?
>>>>
>>>>
>>>>
>>>> --
>>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>>
>>>
>
> --
> Best regards,
> Ivan Pavlukhin
>


-- 
Best regards,
Ivan Pavlukhin

Reply via email to