Search code examples
javamemcachedprotocol-buffersspymemcachedamazon-elasticache

Store and retrieve protocol buffer data from Memcached in Java


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.


Solution

  • 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.