예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function create($key, callable $modifier, $ttl = 0)
 {
     $data = $this->cache->create($key, $modifier, $ttl);
     if ($data) {
         $this->hot[$key] = $data;
     }
     return $data;
 }
예제 #2
0
 /**
  * @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);
 }