Exemple #1
0
 /**
  * Adds data to cache (asking myself if i should encrypt the data with an algorithm)
  * 
  * @param mixed $id string or integer, mostly string
  * @param mixed $value Description
  * 
  * @return boolean
  */
 public function addToCache($id, $value)
 {
     $builder = new ArrayBuilder();
     $builder->addToArray($id, $id, 'name');
     $builder->addToArray($id, time(), 'mtime');
     $builder->addToArray($id, base64_encode(json_encode($value)), 'value');
     return apc_store($id, $builder->getArray($id));
 }
 /**
  * Calls the specific parser functions which are parsing the RAW content
  * 
  * @return array
  */
 public function routeParser()
 {
     $cacheClass = $this->config->getConfig()->options['cache']['class'];
     $cacheManager = new $cacheClass($this->config);
     if ($cacheManager->isExisting('LanguageParserGatewaynn') == 1 && ($ref = $cacheManager->getFromCache('LanguageParserGatewaynn'))) {
     } else {
         $referenceMatcher = new Reference\ReferenceMatcher();
         $arrayBuilder = new ArrayBuilder();
         foreach ($this->constants as $name => $const) {
             $match = $referenceMatcher->getMatch($this->fileList, $const);
             $arrayBuilder->addToArray($this->config->getConfig()->ofwn['mapping']['reference'], $this->reference[$name]->parseContent($match), strtolower($name));
         }
         $ref = $arrayBuilder->getArray($this->config->getConfig()->ofwn['mapping']['reference']);
         $cacheManager->addToCache('LanguageParserGatewaynn', $ref);
     }
     return $ref;
     //return();
 }