<?php
/**
* * * * * * * *<4297088@qq.com>
* */
namespace cn\gz53\framework\sdk\redis;
use cn\gz53\framework\sdk\Sdk;
use Redis;
class RedisSdk extends Sdk
{
private $redis;
private $config;
public function setConfig(RedisConfigSetSdkI $po){
$this->config = $po->getConfig();
return true;
}
public function init(RedisInitSetSdkI $po){
$this->redis = new Redis();
return true;
}
public function connect(RedisConnectSetSdkI $po){
$this->redis->pconnect($this->config['host'], $this->config['port']);
if(!empty($this->config['password'])){
$this->redis->auth($this->config['password']);
}
$this->redis->select($this->config['db']);
return true;
}
public function getRedis(RedisGetSdkI $po){
$po->setRedis($this->redis);
return true;
}
}