Example #1
0
 function getAll()
 {
     $allKey = FileHandler::ls(ZJ_PHP_TMP_PATH . "kv_data/");
     $rt = array();
     foreach ($allKey as $value) {
         $tmpv = explode("/", $value);
         end($tmpv);
         $key = current($tmpv);
         $rt[$key] = $this->get($key);
     }
     return $rt;
 }
 /**
  * 检测执行任务
  */
 static function checkAndDo()
 {
     $t1 = time();
     while (true) {
         if (time() - $t1 > 10) {
             return;
         }
         $files = FileHandler::ls(ZJ_PHP_TMP_PATH . "taskqueue", 1);
         if (count($files) <= 0) {
             return;
         }
         $file = $files[0];
         $url = file_get_contents($file);
         if (is_file($file)) {
             FileHandler::deleteFile($file);
         } else {
             continue;
         }
         $s = new Snoopy();
         $s->fetch($url);
     }
 }