取得数据,支持批量取
mixed Module_Storage_Driver_Redis::get( string/array $key )
参数列表
参数 类型 描述 默认值 $key
string/array
$key
mixed
public function get($key)
{
$this->_connect();
$time = microtime(1);
if (is_array($key))
{
# redis多取
if ($this->prefix)
{
foreach ($key as &$k)
{
$k = $this->prefix . $k;
}
}
$return = $this->_redis->mget($key);
foreach ( $return as &$item )
{
$this->_de_format_data($item);
}
}
else
{
$return = $this->_redis->get($key);
$this->_de_format_data($return);
}
$time = microtime(1) - $time;
if (false===$return)
{
Core::debug()->error($key,'storage redis mis key');
Core::debug()->info($time,'use time');
return false;
}
else
{
Core::debug()->info($key,'storage redis hit key');
Core::debug()->info($time,'use time');
}
return $return;
}