redus 写如队列
<?php
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$password = '123456';
$redis->auth($password); //redis进行密码验证
$arr = array('h','e','l','l','o','w','o','r','l','d');
foreach($arr as $k=>$v){
$redis->rpush("mylist",$v); //rpush(在key 对应 list 的尾部添加字符串元素)
}
?>
redus 读取队列
<?php
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$password = '123456';
$redis->auth($password);
//list类型出队操作
$value = $redis->lpop('mylist'); //读取队列
if($value){
sleep(5); //延时5秒执行
echo "出队的值".$value;
}else{
echo "出队完成";
}
?>