|
@@ -51,10 +51,10 @@ class CacheRedis extends Cache
|
|
return $this->enable;
|
|
return $this->enable;
|
|
}
|
|
}
|
|
|
|
|
|
- public function get($key, $type = ''){
|
|
|
|
|
|
+ public function get($key, $prefix = ''){
|
|
$this->init_slave();
|
|
$this->init_slave();
|
|
if (!$this->enable) return false;
|
|
if (!$this->enable) return false;
|
|
- $this->type = $type;
|
|
|
|
|
|
+ $this->type = $prefix;
|
|
$value = $this->handler->get($this->_key($key));
|
|
$value = $this->handler->get($this->_key($key));
|
|
|
|
|
|
return unserialize($value);
|
|
return unserialize($value);
|
|
@@ -84,6 +84,16 @@ class CacheRedis extends Cache
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function get_org($key,$prefix = '')
|
|
|
|
+ {
|
|
|
|
+ $this->init_master();
|
|
|
|
+ if (!$this->enable) return false;
|
|
|
|
+ $this->type = $prefix;
|
|
|
|
+ $result = $this->handler->get($this->_key($key));
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
public function incr($key,$prefix = '')
|
|
public function incr($key,$prefix = '')
|
|
{
|
|
{
|
|
$this->init_master();
|
|
$this->init_master();
|
|
@@ -94,18 +104,34 @@ class CacheRedis extends Cache
|
|
return $value;
|
|
return $value;
|
|
}
|
|
}
|
|
|
|
|
|
- public function incrby($key,$val,$prefix = '') {
|
|
|
|
-
|
|
|
|
|
|
+ public function incrby($key,$val,$prefix = '')
|
|
|
|
+ {
|
|
|
|
+ $this->init_master();
|
|
|
|
+ if (!$this->enable) return false;
|
|
|
|
+ $this->type = $prefix;
|
|
|
|
+ $key = $this->_key($key);
|
|
|
|
+ $value = $this->handler->incrby($key,$val);
|
|
|
|
+ return $value;
|
|
}
|
|
}
|
|
|
|
|
|
- public function decr($key,$prefix)
|
|
|
|
|
|
+ public function decr($key,$prefix = '')
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ $this->init_master();
|
|
|
|
+ if (!$this->enable) return false;
|
|
|
|
+ $this->type = $prefix;
|
|
|
|
+ $key = $this->_key($key);
|
|
|
|
+ $value = $this->handler->decr($key);
|
|
|
|
+ return $value;
|
|
}
|
|
}
|
|
|
|
|
|
public function decrby($key,$val,$prefix = '')
|
|
public function decrby($key,$val,$prefix = '')
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ $this->init_master();
|
|
|
|
+ if (!$this->enable) return false;
|
|
|
|
+ $this->type = $prefix;
|
|
|
|
+ $key = $this->_key($key);
|
|
|
|
+ $value = $this->handler->decrby($key,$val);
|
|
|
|
+ return $value;
|
|
}
|
|
}
|
|
|
|
|
|
public function zIncrBy($key, $value, $member,$prefix='')
|
|
public function zIncrBy($key, $value, $member,$prefix='')
|