<?php class Queue{    protected $redis;    protected $key;     public function __construct(\Redis $redis, $key)    {        $this->redis = $redis;        $this->key = $key;    }     public function pop()    {        return $this->redis->lPop($this->key); // 左边出    }     public function push($task)    {        return $this->redis->rPush($this->key, $task); // 右边入    }}队列的一个特点就是先进先出(FIFO),很显然,先产生的任务需要被先处理,redis 的 List 可以保证这一点。