From: Andreas K. <ako...@we...> - 2005-10-05 13:25:18
|
Hi! Is it possible to make objects created in Java to persist between HTTP Requests? I'd like to create an object once, and than store it in shared memory, perhaps using apc_store() and apc_fetch(). something like: if (!apc_fetch('java_obj')) { $java_obj = new java('package.object'); $java_obj->doSomeExpensiveCalculation(); apc_store('java_obj', $java_obj); } else { $java_obj = apc_fetch('java_obj'); } Is there any reason not to do something like that? As far as I understand the php-java-bridge, the Java objects completely live in PHP (ZendEngine) when created, so I don't see a reason why this should not work. The JVM is only used to create the object, and php-java-bridge creates "real" PHP objects out of it, right? Or does php-java-bridge forward all methode calls... to the JVM at runtime? Please correct me if I'm wrong! Or do you know about a better alternative to make an Java object persist between requests? best regards Andreas |