I'm using PHP to cache files that are backed by the database. In the course of writing these functions, I end up with a set of variables that are needed by my application, returned in an array. I can either directly generate the array in a .php file, then use require_once to get that variable, or I can use PHP serialization, write that array out to a file, then in my application read the array in, deserialize, etc. I spent awhile trying to look at the performance of php serialization, but except for one unsubstantiated comment on the php serialize() doc page, I haven't found much. Does anyone have any knowledge of that, and also of the two approaches in general? The pro of the serialization is that I think it's slightly easier to write, but the con is that it's harder to read.
Not taking into account the actual performance (you must decide how important this is to you), the quickest to implement would be a combination of serialize(), unserialize(), file_put_contents() and file_get_contents().
Using these functions you could very quickly create a persistent cache for data. It might be quicker though to use a cache that's already out there.
-- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php