redis list php简单队列例子
$redis->connect('127.0.0.1', 6379);
for ($i = 0; $i < 10; $i++) {
$value = 'value_' . date('Y-m-d H:i:s');
$redis->LPUSH('key1', $value);
}
echo $l = $redis->lLen('key1') . "</br>";
for ($i = 0; $i < $l; $i++) {
echo $i.':'.$redis->LPOP('key1') . "</br>";
}
echo $l = $redis->lLen('key1') . "</br>";
//$redis->del('key1');
//$redis->close();
参考:
【高并发简单解决方案】redis队列缓存 + mysql 批量入库 + php离线整合
https://segmentfault.com/a/1190000004136250