How to get all apended objects from a single key.

32 views
Skip to first unread message

Pritam kumar

unread,
Mar 9, 2021, 5:44:56 AMMar 9
to memcached

Hello Team,

I am using Memcached server (version -1.5.22) & spymemcached java client (version - 2.12.3) . In a scenario i have appended multiple objects in single existing key as like below i mentioned :-

User user = new User();
user.setName("Test");
user.setEmail("new...@gmail.com");

Object data = get(Key);

if (data != null) {
    append(key, user));
} else {
    set(key, 0, user));
}

I am able to find all the appended objects from the key using terminal (telnet 127.0.0.1 11211 & fetch data using get key). But when i am trying to get all the appended objects through java client it returns only 1st object which was set 1st time.

I am trying this like below :-

Object userData = get(key);

Please help me that How to get all the appended objects from the key through java client?

Any suggestions or help would be appreciated.

Thanks 
 

dormando

unread,
Mar 9, 2021, 6:37:28 PMMar 9
to memcached
Hey,

Memcached only "thinks" in binary blobs. Append is just stacking the
new object at the end of the new object. If whatever you use to serialize
and de-serialize your objects doesn't understand this it won't return all
of the objects.

You'll need to modify the java client or otherwise provide it with a
custom deserializer.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> memcached+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/memcached/f4b2f833-45e7-4125-a048-daeb5111ea53n%40googlegroups.com.
>
>
Reply all
Reply to author
Forward
0 new messages