1. 程式人生 > 程式設計 >thinkphp5redis快取新增方法例項講解

thinkphp5redis快取新增方法例項講解

找到該檔案
thinkphp/library/think/cache/driver/Redis.php
進行新增方法

在這裡 我就舉例幾個 如何新增 新增的方法檢視 redis教程

在這裡插入圖片描述

/**
   * 返回列表中指定區間內的元素
   * */
  public function lrange($key,$start,$end){

    return $this->handler->lrange($key,$end);

  }
  /**
   * 在list左邊新增元素
   * */
  public function lpush($key,$value){

    return $this->handler->lPush($key,$value);

  }

  /**
   * 在list右邊新增元素
   * */
  public function rpush($key,$value){

    return $this->hawww.cppcns.com
ndler->rPush($key,$value); } /** * 程式設計客棧返回並移除列表中的第一個元素 * */ public function lpop($key){ return $this->handler->lPop($kewww.cppcns.comy); } /** * 返回並移除列表的最後一個元素。 * */ public function rpop($key){ return $this-&gaLpGkPoIt;handler-&gaLpGkPoIt;rPop($key); }

如果還需要新增其他的方法 根據手冊某個方法以及傳值

去修改$this->handler-> 後面的方法函式

到此這篇關於thinkphp5redis快取新增方法的文章就介紹到這了,更多相關thinkphp5 redis快取新增方法內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!