我是靠谱客的博主 朴实鸭子,最近开发中收集的这篇文章主要介绍laravel中redis各方法的使用,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

1vendorpredispredissrcProfileRedisProfile.php

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

array(151) {

["EXISTS"]=>

string(24) "PredisCommandKeyExists"

["DEL"]=>

string(24) "PredisCommandKeyDelete"

["TYPE"]=>

string(22) "PredisCommandKeyType"

["KEYS"]=>

string(22) "PredisCommandKeyKeys"

["RANDOMKEY"]=>

string(24) "PredisCommandKeyRandom"

["RENAME"]=>

string(24) "PredisCommandKeyRename"

["RENAMENX"]=>

string(32) "PredisCommandKeyRenamePreserve"

["EXPIRE"]=>

string(24) "PredisCommandKeyExpire"

["EXPIREAT"]=>

string(26) "PredisCommandKeyExpireAt"

["TTL"]=>

string(28) "PredisCommandKeyTimeToLive"

["MOVE"]=>

string(22) "PredisCommandKeyMove"

["SORT"]=>

string(22) "PredisCommandKeySort"

["DUMP"]=>

string(22) "PredisCommandKeyDump"

["RESTORE"]=>

string(25) "PredisCommandKeyRestore"

["SET"]=>

string(24) "PredisCommandStringSet"

["SETNX"]=>

string(32) "PredisCommandStringSetPreserve"

["MSET"]=>

string(32) "PredisCommandStringSetMultiple"

["MSETNX"]=>

string(40) "PredisCommandStringSetMultiplePreserve"

["GET"]=>

string(24) "PredisCommandStringGet"

["MGET"]=>

string(32) "PredisCommandStringGetMultiple"

["GETSET"]=>

string(27) "PredisCommandStringGetSet"

["INCR"]=>

string(30) "PredisCommandStringIncrement"

["INCRBY"]=>

string(32) "PredisCommandStringIncrementBy"

["DECR"]=>

string(30) "PredisCommandStringDecrement"

["DECRBY"]=>

string(32) "PredisCommandStringDecrementBy"

["RPUSH"]=>

string(27) "PredisCommandListPushTail"

["LPUSH"]=>

string(27) "PredisCommandListPushHead"

["LLEN"]=>

string(25) "PredisCommandListLength"

["LRANGE"]=>

string(24) "PredisCommandListRange"

["LTRIM"]=>

string(23) "PredisCommandListTrim"

["LINDEX"]=>

string(24) "PredisCommandListIndex"

["LSET"]=>

string(22) "PredisCommandListSet"

["LREM"]=>

string(25) "PredisCommandListRemove"

["LPOP"]=>

string(27) "PredisCommandListPopFirst"

["RPOP"]=>

string(26) "PredisCommandListPopLast"

["RPOPLPUSH"]=>

string(34) "PredisCommandListPopLastPushHead"

["SADD"]=>

string(21) "PredisCommandSetAdd"

["SREM"]=>

string(24) "PredisCommandSetRemove"

["SPOP"]=>

string(21) "PredisCommandSetPop"

["SMOVE"]=>

string(22) "PredisCommandSetMove"

["SCARD"]=>

string(29) "PredisCommandSetCardinality"

["SISMEMBER"]=>

string(26) "PredisCommandSetIsMember"

["SINTER"]=>

string(30) "PredisCommandSetIntersection"

["SINTERSTORE"]=>

string(35) "PredisCommandSetIntersectionStore"

["SUNION"]=>

string(23) "PredisCommandSetUnion"

["SUNIONSTORE"]=>

string(28) "PredisCommandSetUnionStore"

["SDIFF"]=>

string(28) "PredisCommandSetDifference"

["SDIFFSTORE"]=>

string(33) "PredisCommandSetDifferenceStore"

["SMEMBERS"]=>

string(25) "PredisCommandSetMembers"

["SRANDMEMBER"]=>

string(30) "PredisCommandSetRandomMember"

["ZADD"]=>

string(22) "PredisCommandZSetAdd"

["ZINCRBY"]=>

string(30) "PredisCommandZSetIncrementBy"

["ZREM"]=>

string(25) "PredisCommandZSetRemove"

["ZRANGE"]=>

string(24) "PredisCommandZSetRange"

["ZREVRANGE"]=>

string(31) "PredisCommandZSetReverseRange"

["ZRANGEBYSCORE"]=>

string(31) "PredisCommandZSetRangeByScore"

["ZCARD"]=>

string(30) "PredisCommandZSetCardinality"

["ZSCORE"]=>

string(24) "PredisCommandZSetScore"

["ZREMRANGEBYSCORE"]=>

string(37) "PredisCommandZSetRemoveRangeByScore"

["PING"]=>

string(29) "PredisCommandConnectionPing"

["AUTH"]=>

string(29) "PredisCommandConnectionAuth"

["SELECT"]=>

string(31) "PredisCommandConnectionSelect"

["ECHO"]=>

string(29) "PredisCommandConnectionEcho"

["QUIT"]=>

string(29) "PredisCommandConnectionQuit"

["INFO"]=>

string(29) "PredisCommandServerInfoV26x"

["SLAVEOF"]=>

string(28) "PredisCommandServerSlaveOf"

["MONITOR"]=>

string(28) "PredisCommandServerMonitor"

["DBSIZE"]=>

string(33) "PredisCommandServerDatabaseSize"

["FLUSHDB"]=>

string(34) "PredisCommandServerFlushDatabase"

["FLUSHALL"]=>

string(29) "PredisCommandServerFlushAll"

["SAVE"]=>

string(25) "PredisCommandServerSave"

["BGSAVE"]=>

string(35) "PredisCommandServerBackgroundSave"

["LASTSAVE"]=>

string(29) "PredisCommandServerLastSave"

["SHUTDOWN"]=>

string(29) "PredisCommandServerShutdown"

["BGREWRITEAOF"]=>

string(41) "PredisCommandServerBackgroundRewriteAOF"

["SETEX"]=>

string(30) "PredisCommandStringSetExpire"

["APPEND"]=>

string(27) "PredisCommandStringAppend"

["SUBSTR"]=>

string(27) "PredisCommandStringSubstr"

["BLPOP"]=>

string(35) "PredisCommandListPopFirstBlocking"

["BRPOP"]=>

string(34) "PredisCommandListPopLastBlocking"

["ZUNIONSTORE"]=>

string(29) "PredisCommandZSetUnionStore"

["ZINTERSTORE"]=>

string(36) "PredisCommandZSetIntersectionStore"

["ZCOUNT"]=>

string(24) "PredisCommandZSetCount"

["ZRANK"]=>

string(23) "PredisCommandZSetRank"

["ZREVRANK"]=>

string(30) "PredisCommandZSetReverseRank"

["ZREMRANGEBYRANK"]=>

string(36) "PredisCommandZSetRemoveRangeByRank"

["HSET"]=>

string(22) "PredisCommandHashSet"

["HSETNX"]=>

string(30) "PredisCommandHashSetPreserve"

["HMSET"]=>

string(30) "PredisCommandHashSetMultiple"

["HINCRBY"]=>

string(30) "PredisCommandHashIncrementBy"

["HGET"]=>

string(22) "PredisCommandHashGet"

["HMGET"]=>

string(30) "PredisCommandHashGetMultiple"

["HDEL"]=>

string(25) "PredisCommandHashDelete"

["HEXISTS"]=>

string(25) "PredisCommandHashExists"

["HLEN"]=>

string(25) "PredisCommandHashLength"

["HKEYS"]=>

string(23) "PredisCommandHashKeys"

["HVALS"]=>

string(25) "PredisCommandHashValues"

["HGETALL"]=>

string(25) "PredisCommandHashGetAll"

["MULTI"]=>

string(31) "PredisCommandTransactionMulti"

["EXEC"]=>

string(30) "PredisCommandTransactionExec"

["DISCARD"]=>

string(33) "PredisCommandTransactionDiscard"

["SUBSCRIBE"]=>

string(30) "PredisCommandPubSubSubscribe"

["UNSUBSCRIBE"]=>

string(32) "PredisCommandPubSubUnsubscribe"

["PSUBSCRIBE"]=>

string(39) "PredisCommandPubSubSubscribeByPattern"

["PUNSUBSCRIBE"]=>

string(41) "PredisCommandPubSubUnsubscribeByPattern"

["PUBLISH"]=>

string(28) "PredisCommandPubSubPublish"

["CONFIG"]=>

string(27) "PredisCommandServerConfig"

["PERSIST"]=>

string(25) "PredisCommandKeyPersist"

["STRLEN"]=>

string(27) "PredisCommandStringStrlen"

["SETRANGE"]=>

string(29) "PredisCommandStringSetRange"

["GETRANGE"]=>

string(29) "PredisCommandStringGetRange"

["SETBIT"]=>

string(27) "PredisCommandStringSetBit"

["GETBIT"]=>

string(27) "PredisCommandStringGetBit"

["RPUSHX"]=>

string(28) "PredisCommandListPushTailX"

["LPUSHX"]=>

string(28) "PredisCommandListPushHeadX"

["LINSERT"]=>

string(25) "PredisCommandListInsert"

["BRPOPLPUSH"]=>

string(42) "PredisCommandListPopLastPushHeadBlocking"

["ZREVRANGEBYSCORE"]=>

string(38) "PredisCommandZSetReverseRangeByScore"

["WATCH"]=>

string(31) "PredisCommandTransactionWatch"

["UNWATCH"]=>

string(33) "PredisCommandTransactionUnwatch"

["OBJECT"]=>

string(27) "PredisCommandServerObject"

["SLOWLOG"]=>

string(28) "PredisCommandServerSlowlog"

["CLIENT"]=>

string(27) "PredisCommandServerClient"

["PTTL"]=>

string(35) "PredisCommandKeyPreciseTimeToLive"

["PEXPIRE"]=>

string(31) "PredisCommandKeyPreciseExpire"

["PEXPIREAT"]=>

string(33) "PredisCommandKeyPreciseExpireAt"

["MIGRATE"]=>

string(25) "PredisCommandKeyMigrate"

["PSETEX"]=>

string(37) "PredisCommandStringPreciseSetExpire"

["INCRBYFLOAT"]=>

string(37) "PredisCommandStringIncrementByFloat"

["BITOP"]=>

string(26) "PredisCommandStringBitOp"

["BITCOUNT"]=>

string(29) "PredisCommandStringBitCount"

["HINCRBYFLOAT"]=>

string(35) "PredisCommandHashIncrementByFloat"

["EVAL"]=>

string(25) "PredisCommandServerEval"

["EVALSHA"]=>

string(28) "PredisCommandServerEvalSHA"

["SCRIPT"]=>

string(27) "PredisCommandServerScript"

["TIME"]=>

string(25) "PredisCommandServerTime"

["SENTINEL"]=>

string(29) "PredisCommandServerSentinel"

["SCAN"]=>

string(22) "PredisCommandKeyScan"

["BITPOS"]=>

string(27) "PredisCommandStringBitPos"

["SSCAN"]=>

string(22) "PredisCommandSetScan"

["ZSCAN"]=>

string(23) "PredisCommandZSetScan"

["ZLEXCOUNT"]=>

string(27) "PredisCommandZSetLexCount"

["ZRANGEBYLEX"]=>

string(29) "PredisCommandZSetRangeByLex"

["ZREMRANGEBYLEX"]=>

string(35) "PredisCommandZSetRemoveRangeByLex"

["ZREVRANGEBYLEX"]=>

string(36) "PredisCommandZSetReverseRangeByLex"

["HSCAN"]=>

string(23) "PredisCommandHashScan"

["PUBSUB"]=>

string(27) "PredisCommandPubSubPubsub"

["PFADD"]=>

string(29) "PredisCommandHyperLogLogAdd"

["PFCOUNT"]=>

string(31) "PredisCommandHyperLogLogCount"

["PFMERGE"]=>

string(31) "PredisCommandHyperLogLogMerge"

["COMMAND"]=>

string(28) "PredisCommandServerCommand"

}

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

1Redis::EXISTS('key');//对应PredisCommandKeyExists

最后

以上就是朴实鸭子为你收集整理的laravel中redis各方法的使用的全部内容,希望文章能够帮你解决laravel中redis各方法的使用所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部