在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. ES6入门教程---数值扩展和数组扩展

    1.数值扩展 var num = 0b11; console.log(num);3 var num = 0o11;console.log(num);9 var num = 1.234; console ...

  2. 【考试记录】2018 山东省队集训第一轮D4(雾)

    T1题意: 给你一个$n\times m$的矩阵$B$,求它能由最少多少个形如两个向量之积$(n\times 1)\times(1\times m)$的矩阵相加得到. 题解: 考虑上界,最多需要$mi ...

  3. 【bzoj1503】[NOI2004]郁闷的出纳员

    1503: [NOI2004]郁闷的出纳员 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 13890  Solved: 5086[Submit][Stat ...

  4. POJ3178 计算几何+DP

    //一些点一些圆,过圆不能连线,相邻点不能连线,问最多连几条线 //计算几何模板+区间dp //关键是判断圆和线段是否相交 #include <cstdio> #include <c ...

  5. 前端JavaScript(2) --常用内置对象,函数,伪数组 arguments,关于DOM的事件操作,DOM介绍

    昨日内容回顾 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...

  6. Web自动化测试—PO设计模式(三)

    test_case目录下面放你要执行的用例 目录结构 ui_auto_test --src --test_case --__init.py --test_login_case --pages --__ ...

  7. MS SqlServer之Exec和EXEC SP_EXECUTESQL

    exec执行sql时字符串时,不能给变量赋值,如果要在sql里给变量赋值,请用EXEC SP_EXECUTESQL 示例: 通过 SP_EXECUTESQL 的第2个参数来定义有哪些参数 输出的加OU ...

  8. 基于JAVA的设计模式之组合模式

    概念 将所有对象组合成一种树形结构,有分支节点.叶子节点,分支节点可以有自己的子节点,子节点可以是分支节点.叶子节点,可以进行增删的操作,而叶子节点不可以.比如文件夹就是一个分支节点,而文件就是一个叶 ...

  9. $.ajax同步/异步(async:false/true)

    虽然说ajax用来执行异步请求的比较多,但有时还是存在需要同步执行的情况的. 比如:我需要通过ajax取执行请求以返回一个值,这个值在ajax后面是需要使用到的,这时就不能用异步请求了.这时候就需要使 ...

  10. Unity的stateMachineBehaviour

    Unity5新增的StateMachineBehaviour是对状态机的内置,确实方便了很多,这里记录它的两个问题: 1.如果正在执行的状态被打断,当前状态的OnStateExit不会被执行,该问题在 ...