Tan Ai Leen wrote: > That's a solution. But it will be better if it is integrated in SOAP.
Suppose some form of caching does get integrated into PEAR::SOAP.
Next, suppose I don't want, or am unable, to use that caching mechanism. I would have a MUCH bigger task on my hands, as I would have to subclass whatever SOAP classes integrate the caching, disable the caching code, and implement my own. This could take hundreds of lines of code to accomplish!
Whereas if it is left to me to cache the WSDL, I can perform the following:
require_once( 'Cache.php' ); $cacheOptions = array( 'cache_dir' => '/tmp/php/cache', 'filename_prefix' => 'pear_cache_' ); $cache = new cache("file", $cacheOptions); $cacheID = $cache->generateID( 'myWSDL' ); $WSDL = $cache->get($cacheID); if( !$WSDL ) { $WSDL = new SOAP_WSDL($wsdl_url); // Add an integer as a 3rd paramter to cache // for that many seconds $cache->save($cacheID, $WSDL); }
Thats A LOT less code to write!
Thats just one type of caching using PEAR::Cache. Numerous other ways exist to perform caching, both at the script level( Other types of PEAR::Cache, PEAR::Cache_Lite), and at the byte-code level (ZendAccelerator, ionCube PHP Accelerator, or my current favorite, Turck MMCache). Each of these have well-documented APIs on their use, and it really makes your life a lot easier as a programmer.
So, it is my considered opinion that leaving caching out of PEAR::SOAP, and thus leaving it up to the programmer to cache the WSDL in the way he or she sees fit, is the better solution.
Oh, here's an article on using PEAR::Cache: http://www.onlamp.com/pub/a/php/2001/10/11/pearcache.html
== Will Green
-- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php