laravel中redis各方法的使用
2018-06-22 05:13:27来源:未知 阅读 ()
在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
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- PHP写UltraEdit插件脚本实现方法 2020-03-29
- php 带逗号千位符数字的处理方法 2020-03-28
- ThinkPHP3.1.x修改成功与失败跳转页面的方法 2020-03-22
- PHP实现打包下载文件的方法示例 2020-03-17
- PHP获取数组中单列值的方法 2020-03-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash