/** * {@inheritdoc} */ public function create($key, callable $modifier, $ttl = 0) { $data = $this->cache->create($key, $modifier, $ttl); if ($data) { $this->hot[$key] = $data; } return $data; }
/** * @expectedException \LinguaLeo\Cache\Exception\AtomicViolationException */ public function testCreateAtomicViolation() { $this->assertFalse($this->cache->get('test')); $modifier = function (&$data) { $this->cache->set('test', 'corrupted'); //atomic violation $data = 'value'; }; $this->cache->create('test', $modifier); }