简体   繁体   中英

Php share object in Memcached with Java

In my recently project. I should share some data object in memcached between Java application and Php application. Use Protobuf to handle the serialize/deserialize process.

But when I write Data object serialize by Protobuf into Memcached in Java application,then Php application use Memcached->get() to get the cached Data object,then use PB4PHP to deserialize Data object. The error happens,it's Memcached->get() deserialize error. like this:

Memcached->get() unable to deserialize data.

I think Php memcached library's method Memcached->get() has a default serialize process. So they can't deserialize the Protobuf byte stream.

Does anyone know how to make it works.

The way objects are stored in php and java are different. Try storing them using some common format like JSON or XML rather than simple serialization. And while fetching, convert it to Java or PHP again. I'll suggest using JSON.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM