Re: Can a PHP 5 Object Be Persisted Past Script End?
| From: | Richard Lynch | Date: | Fri, 18 Aug 2006 16:34:46 +0000 |
| Subject: | Re: Can a PHP 5 Object Be Persisted Past Script End? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240858@lists.php.net to get a copy of this message | ||
On Thu, August 17, 2006 12:14 pm, Bruce Bailey wrote:
> In order to improve performance for a socket-based PHP 5 object, I
> would
> like to persist an object beyond the end of a script. Is there any
> way to
> make this work? Will PHP 5 automatically destroy the object sometime
> after
> the script ends?
Pretty sure the object will not exist when the script ends.
You can serialize it and store it and bring it back (after require'ing
the class definition, or using autoload) but the serialize/unserialize
has a penalty...
If you are already mucking with sockets and such, you could go
whole-hog and consider writing your own message / distribution
handler, so that your socket-based script never actually ends, so the
object never goes away.
--
Like Music?
http://l-i-e.com/artists.htm