Esempio n. 1
0
 private function getquestion($part, $cacheKey)
 {
     $questions = array();
     $filefrontcache = new DataFrontend(array("lifetime" => 172800));
     $memforontcache = new DataFrontend(array("lifetime" => 14400));
     $cache = new Multiple(array(new MemcacheCache($memforontcache, array("perfix" => "cache", "host" => "localhost", "port" => "11211")), new FileCache($filefrontcache, array("perfix" => "cache", "cacheDir" => "../cache/cachefile/"))));
     if (!$cache->exists($cacheKey)) {
         foreach ($part->Factor as $factor) {
             $questions = array_merge($questions, $factor->Question->toArray());
         }
         sort($questions);
         $cache->save($cacheKey, $questions);
     } else {
         $questions = $cache->get($cacheKey);
     }
     return $questions;
 }