first commit
This commit is contained in:
1
金壶/ydyd_service/application/common/driver/.pydio
Normal file
1
金壶/ydyd_service/application/common/driver/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
a484ec55-4a97-4188-9052-d467593c393a
|
||||
85
金壶/ydyd_service/application/common/driver/CustomRedis.php
Normal file
85
金壶/ydyd_service/application/common/driver/CustomRedis.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
namespace app\common\driver;
|
||||
|
||||
use think\cache\driver\Redis;
|
||||
|
||||
class CustomRedis extends Redis
|
||||
{
|
||||
//增加自有方法
|
||||
//常规方法
|
||||
public function keys($name) {
|
||||
$keys_list=$this->handler->keys($this->options['prefix'].$name);
|
||||
$start_index=strlen($this->options['prefix']);
|
||||
foreach ($keys_list as $k=>$v) {
|
||||
$keys_list[$k]=substr($v,$start_index);
|
||||
}
|
||||
return $keys_list;
|
||||
}
|
||||
|
||||
public function batch_del($name) {
|
||||
if (is_array($name)) {
|
||||
foreach ($name as $k=>$v) {
|
||||
$name[$k]=$this->options['prefix'].$v;
|
||||
}
|
||||
} else {
|
||||
$name=$this->options['prefix'].$name;
|
||||
}
|
||||
return $this->handler->delete($name);
|
||||
}
|
||||
|
||||
public function expire($name,$timeout) {
|
||||
return $this->handler->expire($this->options['prefix'].$name,$timeout);
|
||||
}
|
||||
|
||||
//LIST相关操作方法
|
||||
public function lpush($name,$value) {
|
||||
return $this->handler->lpush($this->options['prefix'].$name,$value);
|
||||
}
|
||||
|
||||
public function lrange($name) {
|
||||
return $this->handler->lrange($this->options['prefix'].$name,0,-1);
|
||||
}
|
||||
|
||||
public function llen($name) {
|
||||
return $this->handler->llen($this->options['prefix'].$name);
|
||||
}
|
||||
|
||||
public function lrem($name,$value,$count=0) {
|
||||
return $this->handler->lrem($this->options['prefix'].$name,$value,$count);
|
||||
}
|
||||
|
||||
public function rpoplpush($name) {
|
||||
return $this->handler->rpoplpush($this->options['prefix'].$name,$this->options['prefix'].$name);
|
||||
}
|
||||
|
||||
public function rpop($name) {
|
||||
return $this->handler->rpop($this->options['prefix'].$name);
|
||||
}
|
||||
|
||||
public function brpop($name,$timeout) {
|
||||
return $this->handler->brpop($this->options['prefix'].$name,$timeout);
|
||||
}
|
||||
//--
|
||||
|
||||
//增加hashset方法
|
||||
public function hset($name,$key,$value) {
|
||||
return $this->handler->hset($this->options['prefix'].$name,$key,$value);
|
||||
}
|
||||
|
||||
public function hget($name,$key) {
|
||||
return $this->handler->hget($this->options['prefix'].$name,$key);
|
||||
}
|
||||
|
||||
public function hmget($name,$key_list) {
|
||||
return $this->handler->hmget($this->options['prefix'].$name,$key_list);
|
||||
}
|
||||
|
||||
public function hdel($name,$key) {
|
||||
return $this->handler->hdel($this->options['prefix'].$name,$key);
|
||||
}
|
||||
|
||||
public function hkeys($name) {
|
||||
return $this->handler->hkeys($this->options['prefix'].$name);
|
||||
}
|
||||
//--
|
||||
}
|
||||
Reference in New Issue
Block a user