$questions_pre = $this->questionRepository->getQuestionsFeed();
$key = 'questions';
foreach ($questions_pre as $question) {
//将问题存放到集合中
Redis::sadd($key,$question);
}
//获取集合元素总数(如果指定键不存在返回0)
$nums = Redis::scard($key);
if($nums>0){
//从指定集合中获取数据
$questions = collect(Redis::smembers($key));
}
dd($questions);
修改的评论也不能少于六个字哦!
0
分享