<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Musings &#187; web services</title>
	<atom:link href="http://cbeer.info/blog/tag/web-services/feed/" rel="self" type="application/rss+xml" />
	<link>http://cbeer.info/blog</link>
	<description></description>
	<lastBuildDate>Sun, 05 Sep 2010 02:47:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Zend_Cache for Web Services</title>
		<link>http://cbeer.info/blog/2008/10/25/zend_cache-for-web-services/</link>
		<comments>http://cbeer.info/blog/2008/10/25/zend_cache-for-web-services/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 16:15:14 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[zend cache]]></category>

		<guid isPermaLink="false">http://192.168.2.101/wordpress/?p=6</guid>
		<description><![CDATA[My current project involves a number of SOAP Web Services requests to retrieve information from our Fedora repository. To help minimize overhead from HTTP requests, I‚Äôm using Zend Framework‚Äôs Zend_Cache_Frontend_Class to wrap the whole Fedora/PHP interface class. Zend_Cache allows me &#8230; <a href="http://cbeer.info/blog/2008/10/25/zend_cache-for-web-services/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My current project involves a number of SOAP Web Services requests to retrieve information from our <a href="http://fedora-commons.org">Fedora repository</a>. To help minimize overhead from HTTP requests, I‚Äôm using Zend Framework‚Äôs <a href="http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.class">Zend_Cache_Frontend_Class</a> to wrap the whole Fedora/PHP interface class. Zend_Cache allows me to implement this style of caching with only a single line of code.</p>
<p>
Our web services consumer provides a couple of access methods that can be safely cached:</p>
<pre name="code" class="php">class Fedora_Object
{
/* .... */
	        public function getDissemination($pid, $sDefPid, $methodName, $parameters, $asOfDateTime = null) {
           try {
                   return Fedora_Repository::get('API-A', $pid)-&gt;getDissemination(array('pid' =&gt; $pid,
                                                     'serviceDefinitionPid' =&gt; $sDefPid,
                                                     'methodName' =&gt; $methodName,
                                                     'parameters' =&gt; $parameters,
                                                     'asOfDateTime' =&gt; $asOfDateTime));
                } catch(SoapFault $s) {
                       return $s;
                }
        }
/* .... */
}</pre>
</p>
<p>
In the bootstrap file, instead of initializing the Fedora_Object class, I wrap it in a Zend_Cache instance:</p>
<pre name="code" class="php">$fedora = Zend_Cache::factory('Class', 'File', array('cached_entity' =&gt; new Fedora_Object(),
                          'cached_methods' =&gt; array('getObjectXML', 'getDatastreamDissemination', 'getDissemination'),
                           'cache_by_default' =&gt; false));</pre>
<p>This code tells Zend_Cache to cache only the specified cached_methods and pass everything else through. Easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://cbeer.info/blog/2008/10/25/zend_cache-for-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
