<?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); // 右边入 } }
原文地址:http://blog.csdn.net/phpfenghuo/article/details/45342247