如何实例讲解ThinkPHP5中Redis缓存新方法的使用?
- 内容介绍
- 文章标签
- 相关推荐
本文共计278个文字,预计阅读时间需要2分钟。
找到文件 + thinkphp/library/think/cache/driver/Redis.php + 进行新增方法 + 在此处 + 我就举几个例子 + 如何添加 + 添加的方法查看 + redis教程 + + + + 返回列表中指定区间内的元素 + + + / + public function lrange($key, $sta)
找到该文件
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-> 后面的方法函数
到此这篇关于thinkphp5redis缓存新增方法的文章就介绍到这了,更多相关thinkphp5 redis缓存新增方法内容请搜索自由互联以前的文章或继续浏览下面的相关文章希望大家以后多多支持自由互联!
本文共计278个文字,预计阅读时间需要2分钟。
找到文件 + thinkphp/library/think/cache/driver/Redis.php + 进行新增方法 + 在此处 + 我就举几个例子 + 如何添加 + 添加的方法查看 + redis教程 + + + + 返回列表中指定区间内的元素 + + + / + public function lrange($key, $sta)
找到该文件
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-> 后面的方法函数
到此这篇关于thinkphp5redis缓存新增方法的文章就介绍到这了,更多相关thinkphp5 redis缓存新增方法内容请搜索自由互联以前的文章或继续浏览下面的相关文章希望大家以后多多支持自由互联!

