<?php
/**
* User: liaosp
* Date: 2018/5/30
* Time: 15:22
*/
namespace app\api\model;
use think\Model;
class Redis extends Model
{
private $Redis;
function __construct($data = [])
{
parent::__construct($data);
$this->Redis = $this->redis = new \Redis;
$this->Redis->connect('127.0.0.1', 6379);
}
public function setRedis($name,$value,$exp=''){
global $fromhost;
return $this->Redis->set($fromhost.$name,$value,$exp);
}
public function getRedis($name){
global $fromhost;
return $this->Redis->get($fromhost.$name);
}
public function lpush($name,$value){
global $fromhost;
return $this->Redis->lPush($fromhost.$name,$value);
}
public function blpop($name){
global $fromhost;
return $this->Redis->rPop($fromhost.$name);
}
}
Redis 分装到项目中使用
猜你喜欢
转载自blog.csdn.net/qq_22823581/article/details/80838646
今日推荐
周排行