示例#1
0
 /**
  * {@inheritDoc}
  */
 public function putClassMetadataInCache(ClassMetadata $metadata)
 {
     if ($this->debug) {
         return;
     }
     $cacheId = md5(self::CACHE_PREFIX . $metadata->name);
     if (false === $this->cache->save($cacheId, serialize($metadata), true)) {
         throw new \RuntimeException(sprintf('Could not write new metadata cache for %s.', $metadata->name));
     }
 }
 /**
  * Returns all classcontents classnames
  *
  * @return string[] An array that contains all classcontents classnames
  */
 public function getAllClassContentClassnames()
 {
     if (null === $this->contentClassnames) {
         $cacheId = md5('all_classcontents_classnames_' . $this->app->getContext() . '_' . $this->app->getEnvironment());
         if (!$this->app->isDebugMode() && false !== ($value = $this->cache->load($cacheId))) {
             $this->contentClassnames = json_decode($value, true);
         } else {
             $this->contentClassnames = [AbstractClassContent::CLASSCONTENT_BASE_NAMESPACE . 'ContentSet'];
             foreach ($this->app->getClassContentDir() as $directory) {
                 $this->contentClassnames = array_merge($this->contentClassnames, CategoryManager::getClassContentClassnamesFromDir($directory));
             }
             $this->cache->save($cacheId, json_encode($this->contentClassnames));
         }
     }
     return $this->contentClassnames;
 }