コード例 #1
0
 /**
  * @param Task $task
  * @return null
  */
 public function addTask(Task $task)
 {
     $taskKey = $task->getKey();
     $taskSpecificKey = $this->taskListKey . $taskKey;
     $serialized = serialize($task);
     $existingStatus = $this->getStatus($task);
     if ($existingStatus) {
         //TODO - what should happen here?
         return $taskSpecificKey;
     }
     $this->redisClient->set($taskSpecificKey, $serialized, 'EX', self::TASK_TTL);
     $this->redisClient->rpush($this->announceListKey, $taskKey);
     $this->setStatus($task, TaskQueue::STATE_INITIAL);
     return true;
 }
コード例 #2
0
 /**
  * @param Task $task
  * @return string
  */
 function getStatus(Task $task)
 {
     $statusKey = $this->statusKey . $task->getKey();
     return $this->redisClient->get($statusKey);
 }