php使用redis队列简单实用
简介:队列要遵守先进先出的原则
public function test01(){
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$arr = array('h','e','l','l','o','w','o','r','l','d');
foreach($arr as $v) {
$redis->rpush("mylist",$v);
}
}
public function test02(){
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
//list类型出队操作
$value = $redis->lpop('mylist');
if($value){
echo "出队的值".$value;
}else{
echo "出队完成";
}
}