|
@@ -52,17 +52,19 @@ class Redis implements Intf
|
|
|
*/
|
|
|
public function hMset($id, $data, array $policy = null)
|
|
|
{
|
|
|
+ $res = false;
|
|
|
if (is_array($policy)) {
|
|
|
$this->policy = array_merge($this->policy, $policy);
|
|
|
}
|
|
|
try {
|
|
|
- $this->redis->hMset($id, $data);
|
|
|
+ $res = $this->redis->hMset($id, $data);
|
|
|
if (isset($this->policy['life_time']) && $this->policy['life_time'] > 0) {
|
|
|
$this->redis->setTimeout($id, $this->policy['life_time']);
|
|
|
}
|
|
|
} catch (\CredisException $e) {
|
|
|
throw new \Qii\Exceptions\Errors(\Qii::i(-1, $e->getMessage()), __LINE__);
|
|
|
}
|
|
|
+ return $res;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -70,17 +72,20 @@ class Redis implements Intf
|
|
|
*/
|
|
|
public function set($id, $value, array $policy = null)
|
|
|
{
|
|
|
+ $res = false;
|
|
|
if (is_array($policy)) {
|
|
|
$this->policy = array_merge($this->policy, $policy);
|
|
|
}
|
|
|
try {
|
|
|
- $this->redis->set($id, $value);
|
|
|
+ $res = $this->redis->set($id, $value);
|
|
|
if (isset($this->policy['life_time']) && $this->policy['life_time'] > 0) {
|
|
|
$this->redis->setTimeout($id, $this->policy['life_time']);
|
|
|
}
|
|
|
} catch (\CredisException $e) {
|
|
|
throw new \Qii\Exceptions\Errors(\Qii::i(-1, $e->getMessage()), __LINE__);
|
|
|
}
|
|
|
+
|
|
|
+ return $res;
|
|
|
}
|
|
|
/**
|
|
|
* 获取指定key的数据
|