在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. [Android]解决 Could not read entry xxx from cache taskArtifacts.bin

    Bug 出现 事情是这样的,昨天早晨我正做着项目,坐在我旁边的小伙伴呼唤了我一下,说项目运行不起来了. 我纳闷着,前天的时候还好好的,怎么过了一晚就出问题了.我问他是不是改了什么配置,或者添加了什么东 ...

  2. HDU-1151-AirRaid(最小路径覆盖)

    链接:https://vjudge.net/problem/HDU-1151#author=0 题意: 一个城镇有n个路口,由一些单向马路连接.现在要安排一些伞兵降落在某些路口上,清查所有的路口.一个 ...

  3. 【NOI2014】起床困难综合症 贪心

    从高到低按位贪心,讨论一下初始0或1,分别暴力算出结果是什么 如果一开始0就能得1当然直接ans垒起来 如果1能得1而且当前m够用,那也垒起来,同时m减掉 否则gg 2min的代码 #include ...

  4. java颜色代码对照表

    LightPink 浅粉色 #FFB6C1 255,182,193 Pink 粉红 #FFC0CB 255,192,203 Crimson 猩红 #DC143C 220,20,60 LavenderB ...

  5. 《springcloud 五》springcloud stream

    什么是消息驱动? SpringCloud Stream消息驱动可以简化开发人员对消息中间件的使用复杂度,让系统开发人员更多尽力专注与核心业务逻辑的开发.SpringCloud Stream基于Spri ...

  6. ruby 字符串常用方法学习

    引用链接:http://www.blogjava.net/nkjava/archive/2010/01/03/308088.html 1,切片:silce, [ ]-----------------[ ...

  7. Redis数据库2

    一.存储list 1.概述     list类型是按照插入顺序排序的字符串链表,可以在头部(left)和尾部(right)添加新的元素,如果不存在,则自动创建;如果list中所有元素被移除,则list ...

  8. 判断浏览器是pc端还是移动端

    var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...

  9. C++ error:Debug Assertion Failed.Expression:_BLOCK_TYPE_IS_VALID(phead->nBlock)

    Debug Assertion Failed.Expression:_BLOCK_TYPE_IS_VALID(phead->nBlockUse) 关于上面这个错误,我在上一篇文章中的程序遇到过了 ...

  10. pm2-web监控

    pm2-web 是一款 pm2 服务状态监控程序,基于 web . 安装 npm install -g pm2-web 运行(默认占用8080端口) pm2-web 自定义配置文件 通过 --conf ...