|
From: <php...@li...> - 2009-07-21 19:25:55
|
O wise developers,
I am trying to persist a java object (from PHP) using PHP/Java Bridge,
because interacting with that object is expensive and I don't want to
repeat calculations. I have read through the examples and the FAQ,
and done some searching through the mailing list, but found very few
references to persistence. The only references I did find used
sessions. It was fairly easy to implement persistence using a named
session, but I found that it has the problem of eventual expiration.
Is this the only way to persist an object? The FAQ seems to imply
that there is another (built-in) way, but it doesn't give any hint as
to what that might be.
I am running PHP/Java Bridge 5.4.4.2 on Tomcat 6.0.20, and connecting
to it from PHP5 running on a vanilla Apache2 install.
Thanks for your help,
- Chris Sullins
>From the FAQ:
> Q: How do I make my script state (objects or variables) persistent?
> A: If you must code it yourself: with e.g. java_session()->put("buf", $stringBuffer)
>From the Session Sharing example:
if(is_null(java_values($session->get("counter")))) {
$session->put("counter", 1);
}
$counter = java_values($session->get("counter"));
|