定位Redis驱动文件位置
定位到对应的驱动文件
thinkphp/library/think/cache/driver/Redis.php
在该文件中添加所需的新增方法
此处仅列举部分示例,具体的添加方式可参考相关的Redis教程文档

/**
* 返回列表中指定区间内的元素
* */
public function lrange($key,$start,$end){
return $this->handler->lrange($key,$start,$end);
}
/**
* 在list左边新增元素
* */
public function lpush($key,$value){
return $this->handler->lPush($key,$value);
}
/**
* 在list右边新增元素
* */
public function rpush($key,$value){
return $this->handler->rPush($key,$value);
}
/**
* 返回并移除列表中的第一个元素
* */
public function lpop($key){
return $this->handler->lPop($key);
}
/**
* 返回并移除列表的最后一个元素。
* */
public function rpop($key){
return $this->handler->rPop($key);
}
若需补充其他功能,请参照官方手册中对应方法的参数说明 调整$this->handler-> 后调用的具体函数逻辑
关于ThinkPHP5 Redis缓存新增方法的介绍至此结束,如需了解更多相关内容,建议查阅本站历史文章或继续阅读后续章节,感谢大家的支持!