php redis实现一个延迟消息队列代码
代码语言:phpcli
所属分类:其他
代码描述:php redis实现一个延迟消息队列代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<?php
class DelayQueue
{
protected $prefix = 'delay_queue:';
protected $redis = null;
protected $key = '';
private static $_instance = null;
/**
* 构造函数
* DelayQueue constructor.
* @param $queue
* @param array $config
*/
public function __construct($queue,$config = [])
{
$this->key = $this->prefix . $queue;
$this->redis = new Redis();
$this->redis->connect($config['host'], $config['port'], $config['timeout']);
$this->redis->auth($config['auth']);
}
/**
* Notes: 获取数据库句柄方法
* User: jackin.chen
* Date: 2020/7/20 下午3:55
* function: getRedis
* @return null|Redis
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0