Re: cache xml objects in php5
| From: | Jasper Bryant-Greene | Date: | Tue, 27 Sep 2005 01:32:15 +0000 |
| Subject: | Re: cache xml objects in php5 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223242@lists.php.net to get a copy of this message | ||
Kevin Wang wrote:
My php5 web application needs to parse/marshall a bunch of large xml files into php5 objects at the beginning of handling each request. These xml files are static across all the requests and it is really time consuming to parse/marshall them into php5 objects. I am wondering if there is any means to cache these xml objects so that each request will not go through the same time consuming xml parsing/building operation. Serialization doesn't work in my case as deserialization is also very expensive. I am using Apache as the web server. What I am thinking is that if php5 allows us to keep certain objects (and their references) around across all the requests in a child process instead of cleaning all the object memory every time after a script/request is finished.Have you looked at memcache? http://www.php.net/manual/en/ref.memcache.php You install and run the memcached server (it can be on localhost for a single server setup, or for many servers it can be shared if the interconnects are fast enough). Then you can cache just about any PHP variable, including objects, in memory. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/