Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Mar 23, 2016
1 parent 4b23f4b commit ac11af7
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/RedisExtensionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public function __construct()
*/
public function connect()
{
call_user_func_array($this->redis, func_get_args());
return call_user_func_array([$this->redis, 'connect'], func_get_args());
}

/**
* @inheritDoc
*/
public function read($key)
{
$value = $this->redis->get($key);
$value = $this->redis->get($this->prefix.$key);
if ($value) {
return is_numeric($value) ? $value : unserialize($value);
}
Expand All @@ -49,15 +49,15 @@ public function read($key)
*/
public function put($key, $value, $seconds)
{
$this->redis->set($key, is_numeric($value) ? $value : serialize($value), $seconds);
$this->redis->set($this->prefix.$key, is_numeric($value) ? $value : serialize($value), $seconds);
}

/**
* @inheritDoc
*/
public function delete($key)
{
$this->redis->delete($key);
$this->redis->delete($this->prefix.$key);

return true;
}
Expand All @@ -75,11 +75,23 @@ public function flush()
*/
public function getPrefix()
{
return '';
return $this->prefix;
}

public function setPrefix($prefix)
{
$this->prefix = !empty($prefix) ? $prefix.':' : '';
}

/**
* Pass missing methods to Redis.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return call_user_func_array([$this->redis, $method], $parameters);
}
}

0 comments on commit ac11af7

Please sign in to comment.