Store and retrieve protocol buffer data from Memcached in Java

470 views Asked by At

I am using Protocol Buffers for my data and want to store and retrieve this data from Memcached (running on ElastiCache). I am using the MemcachedClient in Java.

I am currently storing data to Memcache using code similiar to this:

memClient.set("keyString", protobufBuilder.build().toByteArray());

But, I am not sure how to get this data from Memcached and convert it back into a Protobuf object.

Any help is really appreciated.

1

There are 1 answers

0
joshnikhil234 On BEST ANSWER

I figured it out.

I simply typecasted the data I get from MemcachedCleint to byte[] and gave it as input to the pasreFrom method of my Protobuf object.