首页 > 编程开发 > PHP    日期:2021-06-03 / 浏览

找到该文件
thinkphp/library/think/cache/driver/Redis.php
进行新增方法

在这里 我就举例几个 如何添加 添加的方法查看 redis教程

thinkphp5redis缓存新增方法实例讲解

/**
   * 返回列表中指定区间内的元素
   * */
  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-> 后面的方法函数

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章