From 1dce958700f01c714ad1f67fb94bbe252224c8c9 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Mon, 28 Mar 2011 00:10:12 -0500 Subject: [PATCH] [Service] Removing extraneous code from Guzzle\Service\ServiceBuilder --- library/Guzzle/Service/ServiceBuilder.php | 41 +------------------ .../Tests/Service/ServiceBuilderTest.php | 4 -- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/library/Guzzle/Service/ServiceBuilder.php b/library/Guzzle/Service/ServiceBuilder.php index 401df903..63de9b14 100644 --- a/library/Guzzle/Service/ServiceBuilder.php +++ b/library/Guzzle/Service/ServiceBuilder.php @@ -26,26 +26,14 @@ class ServiceBuilder */ protected $clients = array(); - /** - * @var CacheAdapterInterface Cache adapter to use for Service caching - */ - protected $cache; - - /** - * @var int Cache entry TTL - */ - protected $ttl; - /** * Create a new ServiceBuilder using an XML configuration file to configure * the registered ServiceBuilder builder objects * * @param string $filename Full path to the XML configuration file * @param CacheAdapterInterface $cacheAdapter (optional) Pass a cache - * adapter to cache the service configuration settings loaded from the - * XML and to cache dynamically built services. - * @param int $ttl (optional) How long to cache items in the cache - * adapter (defaults to 24 hours). + * adapter to cache the XML service configuration settings + * @param int $ttl (optional) How long to cache the parsed XML data * * @return ServiceBuilder * @throws RuntimeException if the file cannot be openend @@ -108,10 +96,6 @@ class ServiceBuilder } $builder = new self($config); - if ($cacheAdapter) { - // Always share the cache - $builder->setCache($cacheAdapter, $ttl); - } return $builder; } @@ -129,27 +113,6 @@ class ServiceBuilder $this->builderConfig = $serviceBuilderConfig; } - /** - * Set the CacheAdapter to pass to generated builders which will allow the - * builders to access the CacheAdapter. This is helpul for speeding up - * the process of parsing and loading dynamically generated clients. - * - * @param CacheAdapterInterface $cacheAdapter (optional) Pass a cache - * adapter to cache the service configuration settings loaded from the - * XML and to cache dynamically built services. - * @param int $ttl (optional) How long to cache items in the cache - * adapter (defaults to 24 hours). - * - * @return ServiceBuilder - */ - public function setCache(CacheAdapterInterface $cacheAdapter, $ttl = 86400) - { - $this->cache = $cacheAdapter; - $this->ttl = $ttl ?: 86400; - - return $this; - } - /** * Get a client using a registered builder * diff --git a/tests/Guzzle/Tests/Service/ServiceBuilderTest.php b/tests/Guzzle/Tests/Service/ServiceBuilderTest.php index d7acd690..feeeb377 100644 --- a/tests/Guzzle/Tests/Service/ServiceBuilderTest.php +++ b/tests/Guzzle/Tests/Service/ServiceBuilderTest.php @@ -105,7 +105,6 @@ EOT; /** * @covers Guzzle\Service\ServiceBuilder::factory - * @covers Guzzle\Service\ServiceBuilder::setCache * @covers Guzzle\Service\ServiceBuilder */ public function testFactoryUsesCacheAdapterWhenAvailable() @@ -124,9 +123,6 @@ EOT; $builder = ServiceBuilder::factory($this->tempFile); $this->assertEquals($s1, $s2); - - $this->assertSame($s1, $s1->setCache($adapter, 86400)); - $client = $s1->get('michael.mock'); } /**