php 内容入redis队列

include("config.php");
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->auth('518car518');

 

$list=$db->getResults("select car_brand_type_id from car_brand_type_info where isused=1");
foreach($list as $key=>$value)
{
debug_log($value,'grap');
$redis->rPush(getQueueKey(),json_encode($value,JSON_UNESCAPED_UNICODE));
}

//随机获取插入队列名
function getQueueKey($priority='')
{
if($priority)
{
return 'QUEUE_BRAND_ARTICLE_KEY_999';
}
return 'QUEUE_BRAND_ARTICLE_KEY_'.mt_rand(0,9);
}

posted @ 2017-01-04 16:15  王君山山  阅读(74)  评论(0编辑  收藏  举报