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