leaderbin/classes/CustomRedis.php
Josh Sherman 9fe9eb7acf Working on this RedisModel class
Got it working fairly well, just trying to get all of my assumption / opinions baked in. Still need to come up with a decent way to generate session hashes to help avoid session collision . Incidentally Retwis seems to be susceptible to this.
2013-12-15 22:59:39 -05:00

32 lines
692 B
PHP

<?php
class CustomRedis extends Object
{
protected $redis = false;
public function __call($name, $arguments)
{
if (!$this->redis)
{
$datasource = $this->config->datasources['redis'];
try
{
$this->redis = parent::getInstance('Redis'); // new Redis();
$this->redis->connect($datasource['hostname'], $datasource['port']);
$this->redis->setOption(Redis::OPT_PREFIX, $datasource['namespace'] . ':');
$this->redis->select($datasource['database']);
}
catch (RedisException $e)
{
exit('There was error connecting to Redis :(');
}
}
//var_dump($name, $arguments);
return call_user_func_array(array($this->redis, $name), $arguments);
}
}
?>