thinkphp5 redis缓存新增方法实例讲解
4646
这篇文章主要介绍了thinkphp5redis缓存新增方法实例讲解,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-> 后面的方法函数
本文网址:https://www.zztuku.com/index.php/detail-8749.html
站长图库 - thinkphp5 redis缓存新增方法实例讲解
申明:如有侵犯,请 联系我们 删除。
您还没有登录,请 登录 后发表评论!
提示:请勿发布广告垃圾评论,否则封号处理!!