0

Is there any solution for java and PHP share the same cache ? That is , java can put objects into cache and PHP can read it out (and vice versa). It's best support clustering.

Memcache with JSON format maybe feasible , but it involves JSON serializing/deserializing , which maybe not so efficient.

Is there any other solution ?

Note : I am not saying "calling java from php (or call php from java) " , so , protobuf or Thrift is not what I want.

Is redis the solution ? or any other solution ?

Thanks.

smallufo
  • 11,516
  • 20
  • 73
  • 111
  • 1
    How about using a database? – ug_ Apr 21 '15 at 18:01
  • @ug_ I guess database is not an option because **it's not cache**. – Luiggi Mendoza Apr 21 '15 at 18:02
  • No . DB is not what I want. – smallufo Apr 21 '15 at 18:02
  • 2
    Why do you think JSON serialization/deserialization is unoptimal? Have you tested the performance to be sure it still doesn't meet your performance requirements? Also, how do you think you can store an object in Java and this is automatically understood by PHP, and vice versa? – Luiggi Mendoza Apr 21 '15 at 18:04
  • what kind of *polyglot* objects do you want to store and share using this cache? –  Apr 21 '15 at 18:05
  • In any way you will need to serialize/deserialize your objects. It may be binary format, text/json etc. But you will need that. Java has good and performant JSON serializers/deserializers, so does PHP. –  Apr 21 '15 at 18:07
  • Yes . I thought the question. But I don't know the answer. So I wonder if anyone ever face the problem . Maybe the interop objects' data structure must be 'simple enough' . But I don't know if there exists such solution. I think big website such as FB may have such requirement... (different language share the same memory cache ) – smallufo Apr 21 '15 at 18:09
  • @Rafael Osipov : yes , memory cache , just like ehcache . and able to overflow to disk, or sync with other nodes. – smallufo Apr 21 '15 at 18:12
  • @smallufo maybe [Hazelcast](http://stackoverflow.com/questions/3045164/choosing-a-distributed-shared-memory-solution)? It can be used from java [and PHP](http://riccardotacconi.blogspot.ru/2009/06/use-hazelcast-library-in-php.html). –  Apr 21 '15 at 18:22
  • @RafaelOsipov : It seems it's through resin's Quercus. But I cannot accept resin. Because it is still javaEE6 , not javaee7 compatible ( I just escape from resin to Tomcat ) . And I am not sure if php's composer can work well with it. ( Quercus seems long time no updated ). anyway , thanks. – smallufo Apr 21 '15 at 18:28

0 Answers0