예제 #1
0
 /**
  * @param AJXP_Node $node
  * @param AJXP_Node $contextNode
  * @param bool $details
  */
 public function loadNodeInfoFromCache(&$node, $contextNode, $details)
 {
     $cDriver = ConfService::getCacheDriverImpl();
     if (empty($cDriver) || !$cDriver->supportsPatternDelete(AJXP_CACHE_SERVICE_NS_NODES)) {
         return;
     }
     $id = $this->computeId($node, $details);
     if (CacheService::contains(AJXP_CACHE_SERVICE_NS_NODES, $id)) {
         $metadata = CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $id);
         if (is_array($metadata)) {
             $node->mergeMetadata($metadata);
             $node->setInfoLoaded($details);
         }
     }
 }
예제 #2
0
 /**
  * See static method
  * @param $repoId
  * @return Repository|null
  */
 public function getRepositoryByIdInst($repoId)
 {
     if (isset($this->configs["REPOSITORIES"]) && isset($this->configs["REPOSITORIES"][$repoId])) {
         return $this->configs["REPOSITORIES"][$repoId];
     }
     if (isset($this->configs["REPOSITORY"]) && $this->configs["REPOSITORY"]->getId() . "" == $repoId) {
         return $this->configs["REPOSITORY"];
     }
     $test = CacheService::fetch(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId);
     if ($test !== false) {
         return $test;
     }
     $test = $this->getConfStorageImpl()->getRepositoryById($repoId);
     if ($test != null) {
         CacheService::save(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId, $test);
         return $test;
     }
     // Finally try to search in default repositories
     if (isset($this->configs["DEFAULT_REPOSITORIES"]) && isset($this->configs["DEFAULT_REPOSITORIES"][$repoId])) {
         $repo = self::createRepositoryFromArray($repoId, $this->configs["DEFAULT_REPOSITORIES"][$repoId]);
         $repo->setWriteable(false);
         CacheService::save(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId, $repo);
         return $repo;
     }
     $hookedRepo = null;
     $args = array($repoId, &$hookedRepo);
     AJXP_Controller::applyIncludeHook("repository.search", $args);
     if ($hookedRepo !== null) {
         return $hookedRepo;
     }
     return null;
 }
예제 #3
0
 /**
  * Get a cache item by key.
  *
  * @param string $key Key to retrieve.
  *
  * @return mixed|null Returns the value or null if not found.
  */
 public function get($key)
 {
     return \CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $key);
 }
 public function url_stat($path, $flags)
 {
     $id = $this->computeCacheId($path, "stat");
     if (CacheService::contains(AJXP_CACHE_SERVICE_NS_NODES, $id)) {
         $stat = CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $id);
         if (is_array($stat)) {
             return $stat;
         }
     }
     $stat = parent::url_stat($path, $flags);
     CacheService::save(AJXP_CACHE_SERVICE_NS_NODES, $id, $stat);
     return $stat;
 }