Exemple #1
0
 /**
  * {@inheritDoc}
  */
 public function extract(HandlerInterface $handler)
 {
     $cacheKey = $this->generateCacheKey($handler);
     $handlerDoc = $this->cache->get($cacheKey);
     if (!$handlerDoc) {
         $handlerDoc = $this->delegate->extract($handler);
         $this->cache->set($cacheKey, $handlerDoc);
     }
     return $handlerDoc;
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  */
 public function loadActions()
 {
     $actions = $this->cache->get($this->key);
     if ($actions) {
         return $actions;
     }
     $actions = $this->loader->loadActions();
     $this->cache->set($this->key, $actions);
     return $actions;
 }
 /**
  * {@inheritDoc}
  */
 public function loadMetadata($class)
 {
     if (is_object($class)) {
         $class = get_class($class);
     }
     $key = 'model_transformer.annotated:' . $class;
     $metadata = $this->cache->get($key);
     if (null === $metadata) {
         $metadata = $this->delegate->loadMetadata($class);
         $this->cache->set($key, $metadata);
     }
     return $metadata;
 }
Exemple #4
0
 /**
  * Test check exists in cache, and entry not exists in storage
  */
 public function testHasInStorageAndNotExists()
 {
     $this->cache1->expects($this->once())->method('has')->with('bar')->willReturn(false);
     $this->cache2->expects($this->once())->method('has')->with('bar')->willReturn(false);
     $data = $this->cache->has('bar');
     $this->assertFalse($data);
 }
Exemple #5
0
 /**
  * {@inheritDoc}
  */
 public function delete($id)
 {
     return $this->cache->remove($id);
 }
Exemple #6
0
 /**
  * {@inheritDoc}
  */
 public function fetch($key)
 {
     return $this->cache->get($key);
 }
Exemple #7
0
 /**
  * {@inheritDoc}
  */
 public function clear($cacheDir)
 {
     $this->cache->cleanup();
 }