Returns the data retrieved from the cache. Since this can return false or
null as a correctly cached value, the return value should not be used to
determine successful retrieval of data- for that use the "isMiss()"
function after call this one. If no value is stored at all then this
function will return null.
function it_shortens_a_url(PoolInterface $pool, ItemInterface $item) { $item->isMiss()->willReturn(false); $item->get()->willReturn('http://short.ly/1234'); $pool->getItem(md5('http://any.url'))->willReturn($item); $this->shorten('http://any.url')->shouldReturn('http://short.ly/1234'); }
/** * {@inheritdoc} */ public function signOut() { $token = $this->tokenCache->get(); if ($token && !$this->tokenCache->isMiss()) { $this->getClient()->get('https://identity.auth.theplatform.com/idm/web/Authentication/signOut', array('query' => array('schema' => '1.0', 'form' => 'json', '_token' => $token))); $this->getLogger()->info('Expired mpx authentication token {token} for {username}.', array('token' => $token, 'username' => $this->getUsername())); } $this->tokenCache->clear(); }
private function assertDisabledStash(\Stash\Interfaces\ItemInterface $item) { $this->assertFalse($item->set('true'), 'storeData returns false for disabled cache'); $this->assertNull($item->get(), 'getData returns null for disabled cache'); $this->assertFalse($item->clear(), 'clear returns false for disabled cache'); $this->assertTrue($item->isMiss(), 'isMiss returns true for disabled cache'); $this->assertFalse($item->extend(), 'extend returns false for disabled cache'); $this->assertTrue($item->lock(100), 'lock returns true for disabled cache'); }