/** * @expectedException OnceSourceException */ public function testSecondFailsBecauseOfOnlyOneTrial() { $values = []; foreach ([0, 1] as $index) { $imago = new OnceSource(); $imago = new CachedTransformer($imago, $this->options); $values[$index] = $imago->get(); $this->cache->redate('2trialfile', -self::HALF_AN_HOUR); } $this->assertSame($values[0], $values[1]); }
public function get() { try { return parent::get(); } catch (RootException $e) { // some error had happened. Let’s try to get the data anyway // from the same cache, but with a longer time to live (ttl2) $options = $this->options(); $cache = clone $options->get('cache'); $cache->options()->set('ttl', $this->options()->get('ttl2')); $key = $options->get('key'); return $cache->get($key); } }