在laravel中使用redis自带方法的时候会发现许多原生的方法都不存在了,laravel对其进行了重新的封装但是在文档中并没有找到相关的资料最后在

\vendor\predis\predis\src\Profile\RedisProfile.php

该文件的createCommand方法重打印出

$this->commands

发现许多方法名是被重写的,以下为所有重新定义的方法名

array(151) {
["EXISTS"]=>
string(24) "Predis\Command\KeyExists"
["DEL"]=>
string(24) "Predis\Command\KeyDelete"
["TYPE"]=>
string(22) "Predis\Command\KeyType"
["KEYS"]=>
string(22) "Predis\Command\KeyKeys"
["RANDOMKEY"]=>
string(24) "Predis\Command\KeyRandom"
["RENAME"]=>
string(24) "Predis\Command\KeyRename"
["RENAMENX"]=>
string(32) "Predis\Command\KeyRenamePreserve"
["EXPIRE"]=>
string(24) "Predis\Command\KeyExpire"
["EXPIREAT"]=>
string(26) "Predis\Command\KeyExpireAt"
["TTL"]=>
string(28) "Predis\Command\KeyTimeToLive"
["MOVE"]=>
string(22) "Predis\Command\KeyMove"
["SORT"]=>
string(22) "Predis\Command\KeySort"
["DUMP"]=>
string(22) "Predis\Command\KeyDump"
["RESTORE"]=>
string(25) "Predis\Command\KeyRestore"
["SET"]=>
string(24) "Predis\Command\StringSet"
["SETNX"]=>
string(32) "Predis\Command\StringSetPreserve"
["MSET"]=>
string(32) "Predis\Command\StringSetMultiple"
["MSETNX"]=>
string(40) "Predis\Command\StringSetMultiplePreserve"
["GET"]=>
string(24) "Predis\Command\StringGet"
["MGET"]=>
string(32) "Predis\Command\StringGetMultiple"
["GETSET"]=>
string(27) "Predis\Command\StringGetSet"
["INCR"]=>
string(30) "Predis\Command\StringIncrement"
["INCRBY"]=>
string(32) "Predis\Command\StringIncrementBy"
["DECR"]=>
string(30) "Predis\Command\StringDecrement"
["DECRBY"]=>
string(32) "Predis\Command\StringDecrementBy"
["RPUSH"]=>
string(27) "Predis\Command\ListPushTail"
["LPUSH"]=>
string(27) "Predis\Command\ListPushHead"
["LLEN"]=>
string(25) "Predis\Command\ListLength"
["LRANGE"]=>
string(24) "Predis\Command\ListRange"
["LTRIM"]=>
string(23) "Predis\Command\ListTrim"
["LINDEX"]=>
string(24) "Predis\Command\ListIndex"
["LSET"]=>
string(22) "Predis\Command\ListSet"
["LREM"]=>
string(25) "Predis\Command\ListRemove"
["LPOP"]=>
string(27) "Predis\Command\ListPopFirst"
["RPOP"]=>
string(26) "Predis\Command\ListPopLast"
["RPOPLPUSH"]=>
string(34) "Predis\Command\ListPopLastPushHead"
["SADD"]=>
string(21) "Predis\Command\SetAdd"
["SREM"]=>
string(24) "Predis\Command\SetRemove"
["SPOP"]=>
string(21) "Predis\Command\SetPop"
["SMOVE"]=>
string(22) "Predis\Command\SetMove"
["SCARD"]=>
string(29) "Predis\Command\SetCardinality"
["SISMEMBER"]=>
string(26) "Predis\Command\SetIsMember"
["SINTER"]=>
string(30) "Predis\Command\SetIntersection"
["SINTERSTORE"]=>
string(35) "Predis\Command\SetIntersectionStore"
["SUNION"]=>
string(23) "Predis\Command\SetUnion"
["SUNIONSTORE"]=>
string(28) "Predis\Command\SetUnionStore"
["SDIFF"]=>
string(28) "Predis\Command\SetDifference"
["SDIFFSTORE"]=>
string(33) "Predis\Command\SetDifferenceStore"
["SMEMBERS"]=>
string(25) "Predis\Command\SetMembers"
["SRANDMEMBER"]=>
string(30) "Predis\Command\SetRandomMember"
["ZADD"]=>
string(22) "Predis\Command\ZSetAdd"
["ZINCRBY"]=>
string(30) "Predis\Command\ZSetIncrementBy"
["ZREM"]=>
string(25) "Predis\Command\ZSetRemove"
["ZRANGE"]=>
string(24) "Predis\Command\ZSetRange"
["ZREVRANGE"]=>
string(31) "Predis\Command\ZSetReverseRange"
["ZRANGEBYSCORE"]=>
string(31) "Predis\Command\ZSetRangeByScore"
["ZCARD"]=>
string(30) "Predis\Command\ZSetCardinality"
["ZSCORE"]=>
string(24) "Predis\Command\ZSetScore"
["ZREMRANGEBYSCORE"]=>
string(37) "Predis\Command\ZSetRemoveRangeByScore"
["PING"]=>
string(29) "Predis\Command\ConnectionPing"
["AUTH"]=>
string(29) "Predis\Command\ConnectionAuth"
["SELECT"]=>
string(31) "Predis\Command\ConnectionSelect"
["ECHO"]=>
string(29) "Predis\Command\ConnectionEcho"
["QUIT"]=>
string(29) "Predis\Command\ConnectionQuit"
["INFO"]=>
string(29) "Predis\Command\ServerInfoV26x"
["SLAVEOF"]=>
string(28) "Predis\Command\ServerSlaveOf"
["MONITOR"]=>
string(28) "Predis\Command\ServerMonitor"
["DBSIZE"]=>
string(33) "Predis\Command\ServerDatabaseSize"
["FLUSHDB"]=>
string(34) "Predis\Command\ServerFlushDatabase"
["FLUSHALL"]=>
string(29) "Predis\Command\ServerFlushAll"
["SAVE"]=>
string(25) "Predis\Command\ServerSave"
["BGSAVE"]=>
string(35) "Predis\Command\ServerBackgroundSave"
["LASTSAVE"]=>
string(29) "Predis\Command\ServerLastSave"
["SHUTDOWN"]=>
string(29) "Predis\Command\ServerShutdown"
["BGREWRITEAOF"]=>
string(41) "Predis\Command\ServerBackgroundRewriteAOF"
["SETEX"]=>
string(30) "Predis\Command\StringSetExpire"
["APPEND"]=>
string(27) "Predis\Command\StringAppend"
["SUBSTR"]=>
string(27) "Predis\Command\StringSubstr"
["BLPOP"]=>
string(35) "Predis\Command\ListPopFirstBlocking"
["BRPOP"]=>
string(34) "Predis\Command\ListPopLastBlocking"
["ZUNIONSTORE"]=>
string(29) "Predis\Command\ZSetUnionStore"
["ZINTERSTORE"]=>
string(36) "Predis\Command\ZSetIntersectionStore"
["ZCOUNT"]=>
string(24) "Predis\Command\ZSetCount"
["ZRANK"]=>
string(23) "Predis\Command\ZSetRank"
["ZREVRANK"]=>
string(30) "Predis\Command\ZSetReverseRank"
["ZREMRANGEBYRANK"]=>
string(36) "Predis\Command\ZSetRemoveRangeByRank"
["HSET"]=>
string(22) "Predis\Command\HashSet"
["HSETNX"]=>
string(30) "Predis\Command\HashSetPreserve"
["HMSET"]=>
string(30) "Predis\Command\HashSetMultiple"
["HINCRBY"]=>
string(30) "Predis\Command\HashIncrementBy"
["HGET"]=>
string(22) "Predis\Command\HashGet"
["HMGET"]=>
string(30) "Predis\Command\HashGetMultiple"
["HDEL"]=>
string(25) "Predis\Command\HashDelete"
["HEXISTS"]=>
string(25) "Predis\Command\HashExists"
["HLEN"]=>
string(25) "Predis\Command\HashLength"
["HKEYS"]=>
string(23) "Predis\Command\HashKeys"
["HVALS"]=>
string(25) "Predis\Command\HashValues"
["HGETALL"]=>
string(25) "Predis\Command\HashGetAll"
["MULTI"]=>
string(31) "Predis\Command\TransactionMulti"
["EXEC"]=>
string(30) "Predis\Command\TransactionExec"
["DISCARD"]=>
string(33) "Predis\Command\TransactionDiscard"
["SUBSCRIBE"]=>
string(30) "Predis\Command\PubSubSubscribe"
["UNSUBSCRIBE"]=>
string(32) "Predis\Command\PubSubUnsubscribe"
["PSUBSCRIBE"]=>
string(39) "Predis\Command\PubSubSubscribeByPattern"
["PUNSUBSCRIBE"]=>
string(41) "Predis\Command\PubSubUnsubscribeByPattern"
["PUBLISH"]=>
string(28) "Predis\Command\PubSubPublish"
["CONFIG"]=>
string(27) "Predis\Command\ServerConfig"
["PERSIST"]=>
string(25) "Predis\Command\KeyPersist"
["STRLEN"]=>
string(27) "Predis\Command\StringStrlen"
["SETRANGE"]=>
string(29) "Predis\Command\StringSetRange"
["GETRANGE"]=>
string(29) "Predis\Command\StringGetRange"
["SETBIT"]=>
string(27) "Predis\Command\StringSetBit"
["GETBIT"]=>
string(27) "Predis\Command\StringGetBit"
["RPUSHX"]=>
string(28) "Predis\Command\ListPushTailX"
["LPUSHX"]=>
string(28) "Predis\Command\ListPushHeadX"
["LINSERT"]=>
string(25) "Predis\Command\ListInsert"
["BRPOPLPUSH"]=>
string(42) "Predis\Command\ListPopLastPushHeadBlocking"
["ZREVRANGEBYSCORE"]=>
string(38) "Predis\Command\ZSetReverseRangeByScore"
["WATCH"]=>
string(31) "Predis\Command\TransactionWatch"
["UNWATCH"]=>
string(33) "Predis\Command\TransactionUnwatch"
["OBJECT"]=>
string(27) "Predis\Command\ServerObject"
["SLOWLOG"]=>
string(28) "Predis\Command\ServerSlowlog"
["CLIENT"]=>
string(27) "Predis\Command\ServerClient"
["PTTL"]=>
string(35) "Predis\Command\KeyPreciseTimeToLive"
["PEXPIRE"]=>
string(31) "Predis\Command\KeyPreciseExpire"
["PEXPIREAT"]=>
string(33) "Predis\Command\KeyPreciseExpireAt"
["MIGRATE"]=>
string(25) "Predis\Command\KeyMigrate"
["PSETEX"]=>
string(37) "Predis\Command\StringPreciseSetExpire"
["INCRBYFLOAT"]=>
string(37) "Predis\Command\StringIncrementByFloat"
["BITOP"]=>
string(26) "Predis\Command\StringBitOp"
["BITCOUNT"]=>
string(29) "Predis\Command\StringBitCount"
["HINCRBYFLOAT"]=>
string(35) "Predis\Command\HashIncrementByFloat"
["EVAL"]=>
string(25) "Predis\Command\ServerEval"
["EVALSHA"]=>
string(28) "Predis\Command\ServerEvalSHA"
["SCRIPT"]=>
string(27) "Predis\Command\ServerScript"
["TIME"]=>
string(25) "Predis\Command\ServerTime"
["SENTINEL"]=>
string(29) "Predis\Command\ServerSentinel"
["SCAN"]=>
string(22) "Predis\Command\KeyScan"
["BITPOS"]=>
string(27) "Predis\Command\StringBitPos"
["SSCAN"]=>
string(22) "Predis\Command\SetScan"
["ZSCAN"]=>
string(23) "Predis\Command\ZSetScan"
["ZLEXCOUNT"]=>
string(27) "Predis\Command\ZSetLexCount"
["ZRANGEBYLEX"]=>
string(29) "Predis\Command\ZSetRangeByLex"
["ZREMRANGEBYLEX"]=>
string(35) "Predis\Command\ZSetRemoveRangeByLex"
["ZREVRANGEBYLEX"]=>
string(36) "Predis\Command\ZSetReverseRangeByLex"
["HSCAN"]=>
string(23) "Predis\Command\HashScan"
["PUBSUB"]=>
string(27) "Predis\Command\PubSubPubsub"
["PFADD"]=>
string(29) "Predis\Command\HyperLogLogAdd"
["PFCOUNT"]=>
string(31) "Predis\Command\HyperLogLogCount"
["PFMERGE"]=>
string(31) "Predis\Command\HyperLogLogMerge"
["COMMAND"]=>
string(28) "Predis\Command\ServerCommand"
}

 只要调用KEY就能使用对应的redis方法了,如:

Redis::EXISTS('key');//对应Predis\Command\KeyExists

  

laravel中redis各方法的使用的更多相关文章

  1. Laravel中Redis的使用

    安装 laravel中使用redis首先需要你通过 Composer 安装 predis/predis 包: composer require predis/predis 配置 redis的配置文件是 ...

  2. laravel中redis队列的使用

    一.配置文件 首先我们需要在配置文件中配置默认队列驱动为Redis,队列配置文件是config/queue.php: return [ 'default' => env('QUEUE_DRIVE ...

  3. laravel中redis数据库的简单使用

    1.简介 性能极高 – Redis能读的速度是110000次/s,写的速度是81000次/s . 丰富的数据类型 – Redis支持二进制案例的 Strings, Lists, Hashes, Set ...

  4. 关于Laravel中使用response()方法调用json()返回数据unicode编码转换的问题解决

    在网上找了好久没有找到,之后一步一步测试,发现了Laravel还是很强大的,解决方案如下: public function response(){ // 返回json数据 $data = [ 'err ...

  5. laravel中Crypt加密方法

    使用Crypt::encrypt对数据进行加密,要引入 use Illuminate\Support\Facades\Crypt;;  对使用Crypt::encrypt加密的数据进行解密的方法时:C ...

  6. laravel中redis pipeline用法说明

    $res = Redis::pipeline(function($pipe) use($params) { for ($i = 0; $i < 1000; $i++) { $pipe->g ...

  7. Laravel 5.1中 Redis 的安装配置及基本使用教程

    关于Redis的介绍我们在之前Laravel 缓存配置一节中已有提及,Redis是一个开源的.基于内存的数据结构存储器,可以被用作数据库.缓存和消息代理.相较Memcached而言,支持更加丰富的数据 ...

  8. Laravel框架中的make方法详解

    为什么网上已经有这么多的介绍Laravel的执行流程了,Laravel的容器详解了,Laravel的特性了,Laravel的启动过程了之类的文章,我还要来再分享呢? 因为,每个人的思维方式和方向是不一 ...

  9. laravel 操作 redis

    laravel框架中本身已经存在相应的redis的配置我们在使用的时候只需要更改配置即可,但是在使用的时候一定要注意命名空间的问题,具体可查看config/app.php下面的aliases数组中具体 ...

随机推荐

  1. JXl常用解析详解

    目的: java解析 excel 无非就是apache poi 或者 jxl 两者在使用上其实都差不多,关键还是看你自己熟悉那个,用那个!我也是初次接触jxl 看很多博客说 jxl只适用于处理小数据量 ...

  2. js 获取两个日期相差的天数--自定义方法

    //获取两个日期的相差天数 datedifference=function(sDate1, sDate2) { var dateSpan, tempDate, iDays; sDate1 = Date ...

  3. jetty jndi数据源

    applicationContext.xml <?xml version="1.0" encoding="utf-8"?> <beans de ...

  4. Java ActiveMQ 示例

    所需引入Jar包: jms-1.1.jar activemq-all-5.15.0.jar 生产者 package com.mousewheel.demo; import javax.jms.Conn ...

  5. 解决Chrome浏览器自动记录用户名和密码的黄色背景问题和该解决方法与tab切换至下一个input冲突的问题。

    哈哈哈,是不是标题很长呀,不逗你们了.其实这么长的标题主要就说了两件事: 第一件:解决Chrome浏览器自动记录用户名和密码的黄色背景问题. 第二件:输入完用户名后按下tab键切换至下一个输入密码in ...

  6. 在CentOS7上源码安装php7--Install php7 from source on CentOS7

    首先下载php源码包并解压: # wget http://cn2.php.net/get/php-7.0.9.tar.gz/from/this/mirror # .tar.gz # cd php- 然 ...

  7. htmlparse

    <html>    <head>        <style>                textarea{                width:800p ...

  8. postgresql+ C#+ DHTMLX 学习汇总

    前台: dhtmlxgrid.显示数据   其格式为: { rows:[ {id:1,data:[1,2,3]} ,{} ]} 如果在postgesql里直接生成这样的串呢?? 这是就今天要做的事. ...

  9. windows服务器安装安全狗时服务名如何填写

    安全狗安装时“服务名”这一栏指的是apache进程的服务名称,即进入“任务管理-服务”里显示的名称. phpstudy等软件搭建的环境需要设置运行模式为“系统服务”后才能看到服务名.

  10. C++析构函数造成Debug Assertion Failed的问题

    昨天写了两个程序,均出现了析构函数造成Debug Assertion Failed的问题,由于是初学c++怎么想也想不通问题出在哪里.今天早上经人指点终于明白问题所在了.下面贴出代码和问题解析:(以下 ...