Version Description
- Bumped PHP requirement to 7.2
- Renamed
WP_REDIS_DIR
toWP_REDIS_PLUGIN_DIR
- Fixed rare fatal error in diagnostics
- Allow Predis v1.1 Composer installs
- Support using
WP_REDIS_CLUSTER
string
Download this release
Release Info
Developer | tillkruess |
Plugin | Redis Object Cache |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.26 to 2.1.1
- dependencies/colinmollenhour/credis/Client.php +120 -30
- dependencies/colinmollenhour/credis/README.markdown +8 -0
- dependencies/colinmollenhour/credis/Sentinel.php +65 -8
- dependencies/predis/predis/CHANGELOG.md +129 -1109
- dependencies/predis/predis/LICENSE +1 -1
- dependencies/predis/predis/README.md +65 -60
- dependencies/predis/predis/VERSION +1 -1
- dependencies/predis/predis/bin/create-command-test +24 -21
- dependencies/predis/predis/bin/create-pear +0 -233
- dependencies/predis/predis/bin/create-phar +0 -71
- dependencies/predis/predis/bin/create-single-file +0 -662
- dependencies/predis/predis/composer.json +7 -5
- dependencies/predis/predis/examples/custom_cluster_distributor.php +3 -3
- dependencies/predis/predis/examples/dispatcher_loop.php +2 -2
- dependencies/predis/predis/examples/lua_scripting_abstraction.php +7 -11
- dependencies/predis/predis/examples/redis_collections_iterators.php +2 -3
- dependencies/predis/predis/examples/replication_complex.php +10 -13
- dependencies/predis/predis/examples/replication_sentinel.php +3 -3
- dependencies/predis/predis/examples/replication_simple.php +6 -6
- dependencies/predis/predis/package.ini +0 -36
- dependencies/predis/predis/src/Autoloader.php +1 -0
- dependencies/predis/predis/src/Client.php +101 -117
- dependencies/predis/predis/src/ClientInterface.php +131 -127
- dependencies/predis/predis/src/Cluster/Distributor/HashRing.php +1 -2
- dependencies/predis/predis/src/Cluster/Hash/PhpiredisCRC16.php +44 -0
- dependencies/predis/predis/src/Cluster/PredisStrategy.php +1 -2
- dependencies/predis/predis/src/Cluster/RedisStrategy.php +3 -5
- dependencies/predis/predis/src/Cluster/SlotMap.php +201 -0
- dependencies/predis/predis/src/Collection/Iterator/CursorBasedIterator.php +2 -2
- dependencies/predis/predis/src/Collection/Iterator/ListKey.php +2 -2
- dependencies/predis/predis/src/Command/Command.php +1 -13
- dependencies/predis/predis/src/Command/CommandInterface.php +1 -1
- dependencies/predis/predis/src/Command/Factory.php +145 -0
- dependencies/predis/predis/src/Command/FactoryInterface.php +43 -0
- dependencies/predis/predis/src/Command/Processor/ProcessorChain.php +2 -3
- dependencies/predis/predis/src/Command/RawCommand.php +17 -22
- dependencies/predis/predis/src/Command/RawFactory.php +44 -0
- dependencies/predis/predis/src/Command/{StringAppend.php → Redis/APPEND.php} +4 -2
- dependencies/predis/predis/src/Command/{ConnectionAuth.php → Redis/AUTH.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerBackgroundRewriteAOF.php → Redis/BGREWRITEAOF.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerBackgroundSave.php → Redis/BGSAVE.php} +4 -2
- dependencies/predis/predis/src/Command/{StringBitCount.php → Redis/BITCOUNT.php} +4 -2
- dependencies/predis/predis/src/Command/{StringBitField.php → Redis/BITFIELD.php} +4 -2
- dependencies/predis/predis/src/Command/{StringBitOp.php → Redis/BITOP.php} +6 -4
- dependencies/predis/predis/src/Command/{StringBitPos.php → Redis/BITPOS.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPopFirstBlocking.php → Redis/BLPOP.php} +6 -4
- dependencies/predis/predis/src/Command/{ListPopLastBlocking.php → Redis/BRPOP.php} +17 -2
- dependencies/predis/predis/src/Command/{ListPopLastPushHeadBlocking.php → Redis/BRPOPLPUSH.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerClient.php → Redis/CLIENT.php} +5 -3
- dependencies/predis/predis/src/Command/{ServerCommand.php → Redis/COMMAND.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerConfig.php → Redis/CONFIG.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerDatabaseSize.php → Redis/DBSIZE.php} +4 -2
- dependencies/predis/predis/src/Command/{StringDecrement.php → Redis/DECR.php} +4 -2
- dependencies/predis/predis/src/Command/{StringDecrementBy.php → Redis/DECRBY.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyDelete.php → Redis/DEL.php} +8 -4
- dependencies/predis/predis/src/Command/{TransactionDiscard.php → Redis/DISCARD.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyDump.php → Redis/DUMP.php} +4 -2
- dependencies/predis/predis/src/Command/{ConnectionEcho.php → Redis/ECHO_.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerEvalSHA.php → Redis/EVALSHA.php} +2 -2
- dependencies/predis/predis/src/Command/{ServerEval.php → Redis/EVAL_.php} +4 -2
- dependencies/predis/predis/src/Command/{TransactionExec.php → Redis/EXEC.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyExists.php → Redis/EXISTS.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyExpire.php → Redis/EXPIRE.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyExpireAt.php → Redis/EXPIREAT.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerFlushAll.php → Redis/FLUSHALL.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerFlushDatabase.php → Redis/FLUSHDB.php} +4 -2
- dependencies/predis/predis/src/Command/{GeospatialGeoAdd.php → Redis/GEOADD.php} +6 -4
- dependencies/predis/predis/src/Command/{GeospatialGeoDist.php → Redis/GEODIST.php} +4 -2
- dependencies/predis/predis/src/Command/{GeospatialGeoHash.php → Redis/GEOHASH.php} +6 -4
- dependencies/predis/predis/src/Command/{GeospatialGeoPos.php → Redis/GEOPOS.php} +6 -4
- dependencies/predis/predis/src/Command/{GeospatialGeoRadius.php → Redis/GEORADIUS.php} +6 -4
- dependencies/predis/predis/src/Command/{GeospatialGeoRadiusByMember.php → Redis/GEORADIUSBYMEMBER.php} +2 -2
- dependencies/predis/predis/src/Command/{StringGet.php → Redis/GET.php} +4 -2
- dependencies/predis/predis/src/Command/{StringGetBit.php → Redis/GETBIT.php} +4 -2
- dependencies/predis/predis/src/Command/{StringGetRange.php → Redis/GETRANGE.php} +4 -2
- dependencies/predis/predis/src/Command/{StringGetSet.php → Redis/GETSET.php} +4 -2
- dependencies/predis/predis/src/Command/{HashDelete.php → Redis/HDEL.php} +8 -4
- dependencies/predis/predis/src/Command/{HashExists.php → Redis/HEXISTS.php} +4 -2
- dependencies/predis/predis/src/Command/{HashGet.php → Redis/HGET.php} +4 -2
- dependencies/predis/predis/src/Command/{HashGetAll.php → Redis/HGETALL.php} +4 -2
- dependencies/predis/predis/src/Command/{HashIncrementBy.php → Redis/HINCRBY.php} +4 -2
- dependencies/predis/predis/src/Command/{HashIncrementByFloat.php → Redis/HINCRBYFLOAT.php} +4 -2
- dependencies/predis/predis/src/Command/{HashKeys.php → Redis/HKEYS.php} +4 -2
- dependencies/predis/predis/src/Command/{HashLength.php → Redis/HLEN.php} +4 -2
- dependencies/predis/predis/src/Command/{HashGetMultiple.php → Redis/HMGET.php} +8 -4
- dependencies/predis/predis/src/Command/{HashSetMultiple.php → Redis/HMSET.php} +7 -5
- dependencies/predis/predis/src/Command/{HashScan.php → Redis/HSCAN.php} +6 -4
- dependencies/predis/predis/src/Command/{HashSet.php → Redis/HSET.php} +4 -2
- dependencies/predis/predis/src/Command/{HashSetPreserve.php → Redis/HSETNX.php} +4 -2
- dependencies/predis/predis/src/Command/{HashStringLength.php → Redis/HSTRLEN.php} +4 -2
- dependencies/predis/predis/src/Command/{HashValues.php → Redis/HVALS.php} +4 -2
- dependencies/predis/predis/src/Command/{StringIncrement.php → Redis/INCR.php} +4 -2
- dependencies/predis/predis/src/Command/{StringIncrementBy.php → Redis/INCRBY.php} +4 -2
- dependencies/predis/predis/src/Command/{StringIncrementByFloat.php → Redis/INCRBYFLOAT.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerInfo.php → Redis/INFO.php} +47 -30
- dependencies/predis/predis/src/Command/{KeyKeys.php → Redis/KEYS.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerLastSave.php → Redis/LASTSAVE.php} +4 -2
- dependencies/predis/predis/src/Command/{ListIndex.php → Redis/LINDEX.php} +4 -2
- dependencies/predis/predis/src/Command/{ListInsert.php → Redis/LINSERT.php} +4 -2
- dependencies/predis/predis/src/Command/{ListLength.php → Redis/LLEN.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPopFirst.php → Redis/LPOP.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPushHead.php → Redis/LPUSH.php} +14 -2
- dependencies/predis/predis/src/Command/{ListPushHeadX.php → Redis/LPUSHX.php} +4 -2
- dependencies/predis/predis/src/Command/{ListRange.php → Redis/LRANGE.php} +4 -2
- dependencies/predis/predis/src/Command/{ListRemove.php → Redis/LREM.php} +4 -2
- dependencies/predis/predis/src/Command/{ListSet.php → Redis/LSET.php} +4 -2
- dependencies/predis/predis/src/Command/{ListTrim.php → Redis/LTRIM.php} +4 -2
- dependencies/predis/predis/src/Command/{StringGetMultiple.php → Redis/MGET.php} +8 -4
- dependencies/predis/predis/src/Command/{KeyMigrate.php → Redis/MIGRATE.php} +6 -4
- dependencies/predis/predis/src/Command/{ServerMonitor.php → Redis/MONITOR.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyMove.php → Redis/MOVE.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSetMultiple.php → Redis/MSET.php} +7 -5
- dependencies/predis/predis/src/Command/{StringSetMultiplePreserve.php → Redis/MSETNX.php} +2 -2
- dependencies/predis/predis/src/Command/{TransactionMulti.php → Redis/MULTI.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerObject.php → Redis/OBJECT_.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyPersist.php → Redis/PERSIST.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyPreciseExpire.php → Redis/PEXPIRE.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyPreciseExpireAt.php → Redis/PEXPIREAT.php} +4 -2
- dependencies/predis/predis/src/Command/{HyperLogLogAdd.php → Redis/PFADD.php} +8 -4
- dependencies/predis/predis/src/Command/{HyperLogLogCount.php → Redis/PFCOUNT.php} +8 -4
- dependencies/predis/predis/src/Command/{HyperLogLogMerge.php → Redis/PFMERGE.php} +8 -4
- dependencies/predis/predis/src/Command/{ConnectionPing.php → Redis/PING.php} +4 -2
- dependencies/predis/predis/src/Command/{StringPreciseSetExpire.php → Redis/PSETEX.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubSubscribeByPattern.php → Redis/PSUBSCRIBE.php} +14 -2
- dependencies/predis/predis/src/Command/{KeyPreciseTimeToLive.php → Redis/PTTL.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubPublish.php → Redis/PUBLISH.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubPubsub.php → Redis/PUBSUB.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubUnsubscribeByPattern.php → Redis/PUNSUBSCRIBE.php} +14 -2
- dependencies/predis/predis/src/Command/{ConnectionQuit.php → Redis/QUIT.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyRandom.php → Redis/RANDOMKEY.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyRename.php → Redis/RENAME.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyRenamePreserve.php → Redis/RENAMENX.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyRestore.php → Redis/RESTORE.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPopLast.php → Redis/RPOP.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPopLastPushHead.php → Redis/RPOPLPUSH.php} +4 -2
- dependencies/predis/predis/src/Command/{ListPushTail.php → Redis/RPUSH.php} +8 -4
- dependencies/predis/predis/src/Command/{ListPushTailX.php → Redis/RPUSHX.php} +4 -2
- dependencies/predis/predis/src/Command/{SetAdd.php → Redis/SADD.php} +8 -4
- dependencies/predis/predis/src/Command/{ServerSave.php → Redis/SAVE.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyScan.php → Redis/SCAN.php} +6 -4
- dependencies/predis/predis/src/Command/{SetCardinality.php → Redis/SCARD.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerScript.php → Redis/SCRIPT.php} +4 -2
- dependencies/predis/predis/src/Command/{SetDifference.php → Redis/SDIFF.php} +14 -2
- dependencies/predis/predis/src/Command/Redis/SDIFFSTORE.php +42 -0
- dependencies/predis/predis/src/Command/{ConnectionSelect.php → Redis/SELECT.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerSentinel.php → Redis/SENTINEL.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSet.php → Redis/SET.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSetBit.php → Redis/SETBIT.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSetExpire.php → Redis/SETEX.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSetPreserve.php → Redis/SETNX.php} +4 -2
- dependencies/predis/predis/src/Command/{StringSetRange.php → Redis/SETRANGE.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerShutdown.php → Redis/SHUTDOWN.php} +4 -2
- dependencies/predis/predis/src/Command/{SetIntersection.php → Redis/SINTER.php} +8 -4
- dependencies/predis/predis/src/Command/{SetIntersectionStore.php → Redis/SINTERSTORE.php} +7 -5
- dependencies/predis/predis/src/Command/{SetIsMember.php → Redis/SISMEMBER.php} +4 -2
- dependencies/predis/predis/src/Command/{ServerSlaveOf.php → Redis/SLAVEOF.php} +7 -5
- dependencies/predis/predis/src/Command/{ServerSlowlog.php → Redis/SLOWLOG.php} +4 -2
- dependencies/predis/predis/src/Command/{SetMembers.php → Redis/SMEMBERS.php} +4 -2
- dependencies/predis/predis/src/Command/{SetMove.php → Redis/SMOVE.php} +4 -2
- dependencies/predis/predis/src/Command/{KeySort.php → Redis/SORT.php} +9 -5
- dependencies/predis/predis/src/Command/{SetPop.php → Redis/SPOP.php} +4 -2
- dependencies/predis/predis/src/Command/{SetRandomMember.php → Redis/SRANDMEMBER.php} +4 -2
- dependencies/predis/predis/src/Command/{SetRemove.php → Redis/SREM.php} +8 -4
- dependencies/predis/predis/src/Command/{SetScan.php → Redis/SSCAN.php} +6 -4
- dependencies/predis/predis/src/Command/{StringStrlen.php → Redis/STRLEN.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubSubscribe.php → Redis/SUBSCRIBE.php} +8 -4
- dependencies/predis/predis/src/Command/{StringSubstr.php → Redis/SUBSTR.php} +4 -2
- dependencies/predis/predis/src/Command/{SetUnion.php → Redis/SUNION.php} +14 -2
- dependencies/predis/predis/src/Command/Redis/SUNIONSTORE.php +42 -0
- dependencies/predis/predis/src/Command/{ServerTime.php → Redis/TIME.php} +4 -2
- dependencies/predis/predis/src/Command/Redis/TOUCH.php +40 -0
- dependencies/predis/predis/src/Command/{KeyTimeToLive.php → Redis/TTL.php} +4 -2
- dependencies/predis/predis/src/Command/{KeyType.php → Redis/TYPE.php} +4 -2
- dependencies/predis/predis/src/Command/{PubSubUnsubscribe.php → Redis/UNSUBSCRIBE.php} +8 -4
- dependencies/predis/predis/src/Command/{TransactionUnwatch.php → Redis/UNWATCH.php} +4 -2
- dependencies/predis/predis/src/Command/{TransactionWatch.php → Redis/WATCH.php} +7 -5
- dependencies/predis/predis/src/Command/{ZSetAdd.php → Redis/ZADD.php} +6 -4
- dependencies/predis/predis/src/Command/{ZSetCardinality.php → Redis/ZCARD.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetCount.php → Redis/ZCOUNT.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetIncrementBy.php → Redis/ZINCRBY.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetIntersectionStore.php → Redis/ZINTERSTORE.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetLexCount.php → Redis/ZLEXCOUNT.php} +4 -2
- dependencies/predis/predis/src/Command/Redis/ZPOPMAX.php +44 -0
- dependencies/predis/predis/src/Command/Redis/ZPOPMIN.php +44 -0
- dependencies/predis/predis/src/Command/{ZSetRange.php → Redis/ZRANGE.php} +7 -6
- dependencies/predis/predis/src/Command/{ZSetRangeByLex.php → Redis/ZRANGEBYLEX.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetRangeByScore.php → Redis/ZRANGEBYSCORE.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetRank.php → Redis/ZRANK.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetRemove.php → Redis/ZREM.php} +8 -4
- dependencies/predis/predis/src/Command/{ZSetRemoveRangeByLex.php → Redis/ZREMRANGEBYLEX.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetRemoveRangeByRank.php → Redis/ZREMRANGEBYRANK.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetRemoveRangeByScore.php → Redis/ZREMRANGEBYSCORE.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetReverseRange.php → Redis/ZREVRANGE.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetReverseRangeByLex.php → Redis/ZREVRANGEBYLEX.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetReverseRangeByScore.php → Redis/ZREVRANGEBYSCORE.php} +2 -2
- dependencies/predis/predis/src/Command/{ZSetReverseRank.php → Redis/ZREVRANK.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetScan.php → Redis/ZSCAN.php} +6 -4
- dependencies/predis/predis/src/Command/{ZSetScore.php → Redis/ZSCORE.php} +4 -2
- dependencies/predis/predis/src/Command/{ZSetUnionStore.php → Redis/ZUNIONSTORE.php} +6 -4
- dependencies/predis/predis/src/Command/RedisFactory.php +70 -0
- dependencies/predis/predis/src/Command/ScriptCommand.php +35 -3
- dependencies/predis/predis/src/Command/ServerInfoV26x.php +0 -56
- dependencies/predis/predis/src/Command/SetDifferenceStore.php +0 -28
- dependencies/predis/predis/src/Command/SetUnionStore.php +0 -28
- dependencies/predis/predis/src/CommunicationException.php +3 -3
- dependencies/predis/predis/src/Configuration/ClusterOption.php +0 -76
- dependencies/predis/predis/src/Configuration/ConnectionFactoryOption.php +0 -60
- dependencies/predis/predis/src/Configuration/Option/Aggregate.php +116 -0
- dependencies/predis/predis/src/Configuration/Option/CRC16.php +74 -0
- dependencies/predis/predis/src/Configuration/Option/Cluster.php +100 -0
- dependencies/predis/predis/src/Configuration/Option/Commands.php +145 -0
- dependencies/predis/predis/src/Configuration/Option/Connections.php +144 -0
- dependencies/predis/predis/src/Configuration/{ExceptionsOption.php → Option/Exceptions.php} +5 -2
- dependencies/predis/predis/src/Configuration/{PrefixOption.php → Option/Prefix.php} +9 -3
- dependencies/predis/predis/src/Configuration/Option/Replication.php +135 -0
- dependencies/predis/predis/src/Configuration/Options.php +25 -30
- dependencies/predis/predis/src/Configuration/OptionsInterface.php +11 -18
- dependencies/predis/predis/src/Configuration/ProfileOption.php +0 -69
- dependencies/predis/predis/src/Configuration/ReplicationOption.php +0 -77
- dependencies/predis/predis/src/Connection/AbstractConnection.php +3 -26
- dependencies/predis/predis/src/Connection/AggregateConnectionInterface.php +1 -1
- dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/ClusterInterface.php +1 -1
- dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/PredisCluster.php +65 -57
- dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/RedisCluster.php +48 -101
- dependencies/predis/predis/src/Connection/Factory.php +4 -14
- dependencies/predis/predis/src/Connection/FactoryInterface.php +0 -8
- dependencies/predis/predis/src/Connection/Parameters.php +22 -16
- dependencies/predis/predis/src/Connection/ParametersInterface.php +7 -0
- dependencies/predis/predis/src/Connection/PhpiredisStreamConnection.php +3 -4
- dependencies/predis/predis/src/Connection/{Aggregate → Replication}/MasterSlaveReplication.php +86 -41
- dependencies/predis/predis/src/Connection/{Aggregate → Replication}/ReplicationInterface.php +11 -9
- dependencies/predis/predis/src/Connection/{Aggregate → Replication}/SentinelReplication.php +66 -43
- dependencies/predis/predis/src/Connection/StreamConnection.php +5 -32
- dependencies/predis/predis/src/Connection/WebdisConnection.php +2 -2
- dependencies/predis/predis/src/Monitor/Consumer.php +5 -5
- dependencies/predis/predis/src/Pipeline/Atomic.php +6 -6
- dependencies/predis/predis/src/Pipeline/ConnectionErrorProof.php +3 -3
- dependencies/predis/predis/src/Pipeline/Pipeline.php +2 -2
- dependencies/predis/predis/src/Profile/Factory.php +0 -101
- dependencies/predis/predis/src/Profile/ProfileInterface.php +0 -59
- dependencies/predis/predis/src/Profile/RedisProfile.php +0 -146
- dependencies/predis/predis/src/Profile/RedisUnstable.php +0 -38
- dependencies/predis/predis/src/Profile/RedisVersion200.php +0 -173
- dependencies/predis/predis/src/Profile/RedisVersion220.php +0 -202
- dependencies/predis/predis/src/Profile/RedisVersion240.php +0 -207
- dependencies/predis/predis/src/Profile/RedisVersion260.php +0 -235
- dependencies/predis/predis/src/Profile/RedisVersion280.php +0 -267
- dependencies/predis/predis/src/Profile/RedisVersion300.php +0 -270
- dependencies/predis/predis/src/Profile/RedisVersion320.php +0 -281
- dependencies/predis/predis/src/Protocol/ProtocolException.php +1 -1
- dependencies/predis/predis/src/Protocol/Text/Handler/BulkResponse.php +2 -2
- dependencies/predis/predis/src/Protocol/Text/Handler/IntegerResponse.php +2 -1
- dependencies/predis/predis/src/Protocol/Text/Handler/MultiBulkResponse.php +1 -1
- dependencies/predis/predis/src/Protocol/Text/Handler/StreamableMultiBulkResponse.php +1 -1
- dependencies/predis/predis/src/Protocol/Text/ProtocolProcessor.php +2 -1
- dependencies/predis/predis/src/Protocol/Text/ResponseReader.php +4 -6
- dependencies/predis/predis/src/PubSub/Consumer.php +5 -5
- dependencies/predis/predis/src/PubSub/DispatcherLoop.php +3 -3
- dependencies/predis/predis/src/Response/Status.php +1 -1
- dependencies/predis/predis/src/Session/Handler.php +1 -12
- dependencies/predis/predis/src/Transaction/AbortedMultiExecException.php +2 -1
- dependencies/predis/predis/src/Transaction/MultiExec.php +9 -9
- dependencies/predis/predis/tests/README.md +0 -82
- dependencies/predis/predis/tests/apply-patches.php +0 -16
- dependencies/predis/predis/tests/phpunit_mock_objects.patch +0 -38
- dependencies/predis/predis/tests/phpunit_php7.patch +0 -60
- dependencies/predis/predis/tests/phpunit_php8.patch +0 -39
- dependencies/predis/predis/tests/phpunit_php81.patch +0 -50
- includes/class-plugin.php +5 -1
- includes/diagnostics.php +11 -6
- includes/object-cache.php +392 -47
- includes/ui/settings.php +2 -2
- languages/redis-cache.pot +4 -4
- readme.txt +27 -8
- redis-cache.php +4 -4
dependencies/colinmollenhour/credis/Client.php
CHANGED
@@ -59,7 +59,7 @@ class CredisException extends Exception
|
|
59 |
* @method int|Credis_Client dbsize()
|
60 |
*
|
61 |
* Keys:
|
62 |
-
* @method int|Credis_Client del(string $key)
|
63 |
* @method int|Credis_Client exists(string $key)
|
64 |
* @method int|Credis_Client expire(string $key, int $seconds)
|
65 |
* @method int|Credis_Client expireAt(string $key, int $timestamp)
|
@@ -75,13 +75,13 @@ class CredisException extends Exception
|
|
75 |
* @method int|Credis_Client append(string $key, string $value)
|
76 |
* @method int|Credis_Client decr(string $key)
|
77 |
* @method int|Credis_Client decrBy(string $key, int $decrement)
|
78 |
-
* @method
|
79 |
* @method int|Credis_Client getBit(string $key, int $offset)
|
80 |
* @method string|Credis_Client getRange(string $key, int $start, int $end)
|
81 |
* @method string|Credis_Client getSet(string $key, string $value)
|
82 |
* @method int|Credis_Client incr(string $key)
|
83 |
* @method int|Credis_Client incrBy(string $key, int $decrement)
|
84 |
-
* @method array|Credis_Client
|
85 |
* @method bool|Credis_Client mSet(array $keysValues)
|
86 |
* @method int|Credis_Client mSetNx(array $keysValues)
|
87 |
* @method bool|Credis_Client set(string $key, string $value, int | array $options = null)
|
@@ -194,26 +194,32 @@ class Credis_Client {
|
|
194 |
protected $host;
|
195 |
|
196 |
/**
|
197 |
-
* Scheme of the Redis server (tcp, tls, unix)
|
198 |
-
* @var string
|
199 |
*/
|
200 |
protected $scheme;
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
/**
|
203 |
* Port on which the Redis server is running
|
204 |
-
* @var
|
205 |
*/
|
206 |
protected $port;
|
207 |
|
208 |
/**
|
209 |
* Timeout for connecting to Redis server
|
210 |
-
* @var float
|
211 |
*/
|
212 |
protected $timeout;
|
213 |
|
214 |
/**
|
215 |
* Timeout for reading response from Redis server
|
216 |
-
* @var float
|
217 |
*/
|
218 |
protected $readTimeout;
|
219 |
|
@@ -274,12 +280,12 @@ class Credis_Client {
|
|
274 |
protected $isWatching = FALSE;
|
275 |
|
276 |
/**
|
277 |
-
* @var string
|
278 |
*/
|
279 |
protected $authUsername;
|
280 |
|
281 |
/**
|
282 |
-
* @var string
|
283 |
*/
|
284 |
protected $authPassword;
|
285 |
|
@@ -295,7 +301,7 @@ class Credis_Client {
|
|
295 |
protected $wrapperMethods = array('delete' => 'del', 'getkeys' => 'keys', 'sremove' => 'srem');
|
296 |
|
297 |
/**
|
298 |
-
* @var array
|
299 |
*/
|
300 |
protected $renamedCommands;
|
301 |
|
@@ -309,23 +315,47 @@ class Credis_Client {
|
|
309 |
*/
|
310 |
protected $subscribed = false;
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
/**
|
314 |
* Creates a Redisent connection to the Redis server on host {@link $host} and port {@link $port}.
|
315 |
* $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path]
|
316 |
*
|
317 |
* @param string $host The hostname of the Redis server
|
318 |
-
* @param
|
319 |
-
* @param float $timeout Timeout period in seconds
|
320 |
* @param string $persistent Flag to establish persistent connection
|
321 |
-
* @param int $db The selected
|
322 |
-
* @param string $password The authentication password of the Redis server
|
323 |
-
* @param string $username The authentication username of the Redis server
|
|
|
324 |
*/
|
325 |
-
public function __construct($host = '127.0.0.1', $port = 6379, $timeout = null, $persistent = '', $db = 0, $password = null, $username = null)
|
326 |
{
|
327 |
$this->host = (string) $host;
|
328 |
-
$
|
|
|
|
|
329 |
$this->scheme = null;
|
330 |
$this->timeout = $timeout;
|
331 |
$this->persistent = (string) $persistent;
|
@@ -334,12 +364,16 @@ class Credis_Client {
|
|
334 |
$this->authUsername = $username;
|
335 |
$this->selectedDb = (int)$db;
|
336 |
$this->convertHost();
|
|
|
|
|
|
|
337 |
// PHP Redis extension support TLS/ACL AUTH since 5.3.0
|
|
|
338 |
if ((
|
339 |
-
$this->
|
340 |
|| $this->authUsername !== null
|
341 |
)
|
342 |
-
&& !$this->standalone &&
|
343 |
$this->standalone = true;
|
344 |
}
|
345 |
}
|
@@ -376,6 +410,14 @@ class Credis_Client {
|
|
376 |
return $this->port;
|
377 |
}
|
378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
/**
|
380 |
* Return the selected database
|
381 |
* @return int
|
@@ -426,10 +468,20 @@ class Credis_Client {
|
|
426 |
$this->closeOnDestruct = $flag;
|
427 |
return $this;
|
428 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
protected function convertHost()
|
430 |
{
|
431 |
-
if (preg_match('#^(tcp|tls|unix)://(
|
432 |
-
|
|
|
433 |
$this->scheme = $matches[1];
|
434 |
if ( ! preg_match('#^([^:]+)(:([0-9]+))?(/(.+))?$#', $matches[2], $matches)) {
|
435 |
throw new CredisException('Invalid host format; expected '.$this->scheme.'://host[:port][/persistence_identifier]');
|
@@ -454,6 +506,7 @@ class Credis_Client {
|
|
454 |
$this->scheme = 'tcp';
|
455 |
}
|
456 |
}
|
|
|
457 |
/**
|
458 |
* @throws CredisException
|
459 |
* @return Credis_Client
|
@@ -464,7 +517,7 @@ class Credis_Client {
|
|
464 |
return $this;
|
465 |
}
|
466 |
$this->close(true);
|
467 |
-
|
468 |
if ($this->standalone) {
|
469 |
$flags = STREAM_CLIENT_CONNECT;
|
470 |
$remote_socket = $this->port === NULL
|
@@ -475,18 +528,49 @@ class Credis_Client {
|
|
475 |
$remote_socket .= '/'.$this->persistent;
|
476 |
$flags = $flags | STREAM_CLIENT_PERSISTENT;
|
477 |
}
|
478 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
}
|
480 |
else {
|
481 |
if ( ! $this->redis) {
|
482 |
$this->redis = new Redis;
|
483 |
}
|
484 |
-
$socketTimeout = $this->timeout
|
485 |
try
|
486 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
$result = $this->persistent
|
488 |
-
|
489 |
-
|
|
|
490 |
}
|
491 |
catch(Exception $e)
|
492 |
{
|
@@ -505,7 +589,13 @@ class Credis_Client {
|
|
505 |
}
|
506 |
$failures = $this->connectFailures;
|
507 |
$this->connectFailures = 0;
|
508 |
-
throw new CredisException("Connection to Redis
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
}
|
510 |
|
511 |
$this->connectFailures = 0;
|
@@ -534,7 +624,7 @@ class Credis_Client {
|
|
534 |
* Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout
|
535 |
* if not supported).
|
536 |
*
|
537 |
-
* @param
|
538 |
* @throws CredisException
|
539 |
* @return Credis_Client
|
540 |
*/
|
@@ -1168,7 +1258,7 @@ class Credis_Client {
|
|
1168 |
break;
|
1169 |
case 'auth':
|
1170 |
// For phpredis pre-v5.3, the type signature is string, not array|string
|
1171 |
-
$args =
|
1172 |
break;
|
1173 |
default:
|
1174 |
// Flatten arguments
|
59 |
* @method int|Credis_Client dbsize()
|
60 |
*
|
61 |
* Keys:
|
62 |
+
* @method int|Credis_Client del(string|array $key)
|
63 |
* @method int|Credis_Client exists(string $key)
|
64 |
* @method int|Credis_Client expire(string $key, int $seconds)
|
65 |
* @method int|Credis_Client expireAt(string $key, int $timestamp)
|
75 |
* @method int|Credis_Client append(string $key, string $value)
|
76 |
* @method int|Credis_Client decr(string $key)
|
77 |
* @method int|Credis_Client decrBy(string $key, int $decrement)
|
78 |
+
* @method false|string|Credis_Client get(string $key)
|
79 |
* @method int|Credis_Client getBit(string $key, int $offset)
|
80 |
* @method string|Credis_Client getRange(string $key, int $start, int $end)
|
81 |
* @method string|Credis_Client getSet(string $key, string $value)
|
82 |
* @method int|Credis_Client incr(string $key)
|
83 |
* @method int|Credis_Client incrBy(string $key, int $decrement)
|
84 |
+
* @method false|array|Credis_Client mGet(array $keys)
|
85 |
* @method bool|Credis_Client mSet(array $keysValues)
|
86 |
* @method int|Credis_Client mSetNx(array $keysValues)
|
87 |
* @method bool|Credis_Client set(string $key, string $value, int | array $options = null)
|
194 |
protected $host;
|
195 |
|
196 |
/**
|
197 |
+
* Scheme of the Redis server (tcp, tls, tlsv1.2, unix)
|
198 |
+
* @var string|null
|
199 |
*/
|
200 |
protected $scheme;
|
201 |
|
202 |
+
/**
|
203 |
+
* SSL Meta information
|
204 |
+
* @var string
|
205 |
+
*/
|
206 |
+
protected $sslMeta;
|
207 |
+
|
208 |
/**
|
209 |
* Port on which the Redis server is running
|
210 |
+
* @var int|null
|
211 |
*/
|
212 |
protected $port;
|
213 |
|
214 |
/**
|
215 |
* Timeout for connecting to Redis server
|
216 |
+
* @var float|null
|
217 |
*/
|
218 |
protected $timeout;
|
219 |
|
220 |
/**
|
221 |
* Timeout for reading response from Redis server
|
222 |
+
* @var float|null
|
223 |
*/
|
224 |
protected $readTimeout;
|
225 |
|
280 |
protected $isWatching = FALSE;
|
281 |
|
282 |
/**
|
283 |
+
* @var string|null
|
284 |
*/
|
285 |
protected $authUsername;
|
286 |
|
287 |
/**
|
288 |
+
* @var string|null
|
289 |
*/
|
290 |
protected $authPassword;
|
291 |
|
301 |
protected $wrapperMethods = array('delete' => 'del', 'getkeys' => 'keys', 'sremove' => 'srem');
|
302 |
|
303 |
/**
|
304 |
+
* @var array<string,string>|callable|null
|
305 |
*/
|
306 |
protected $renamedCommands;
|
307 |
|
315 |
*/
|
316 |
protected $subscribed = false;
|
317 |
|
318 |
+
/** @var bool */
|
319 |
+
protected $oldPhpRedis = false;
|
320 |
+
|
321 |
+
/** @var array */
|
322 |
+
protected $tlsOptions = [];
|
323 |
+
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @var bool
|
327 |
+
*/
|
328 |
+
protected $isTls = false;
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Gets Useful Meta debug information about the SSL
|
332 |
+
*
|
333 |
+
* @return string
|
334 |
+
*/
|
335 |
+
public function getSslMeta()
|
336 |
+
{
|
337 |
+
return $this->sslMeta;
|
338 |
+
}
|
339 |
|
340 |
/**
|
341 |
* Creates a Redisent connection to the Redis server on host {@link $host} and port {@link $port}.
|
342 |
* $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path]
|
343 |
*
|
344 |
* @param string $host The hostname of the Redis server
|
345 |
+
* @param int|null $port The port number of the Redis server
|
346 |
+
* @param float|null $timeout Timeout period in seconds
|
347 |
* @param string $persistent Flag to establish persistent connection
|
348 |
+
* @param int $db The selected database of the Redis server
|
349 |
+
* @param string|null $password The authentication password of the Redis server
|
350 |
+
* @param string|null $username The authentication username of the Redis server
|
351 |
+
* @param array|null $tlsOptions The TLS/SSL context options. See https://www.php.net/manual/en/context.ssl.php for details
|
352 |
*/
|
353 |
+
public function __construct($host = '127.0.0.1', $port = 6379, $timeout = null, $persistent = '', $db = 0, $password = null, $username = null, array $tlsOptions = null)
|
354 |
{
|
355 |
$this->host = (string) $host;
|
356 |
+
if ($port !== null) {
|
357 |
+
$this->port = (int) $port;
|
358 |
+
}
|
359 |
$this->scheme = null;
|
360 |
$this->timeout = $timeout;
|
361 |
$this->persistent = (string) $persistent;
|
364 |
$this->authUsername = $username;
|
365 |
$this->selectedDb = (int)$db;
|
366 |
$this->convertHost();
|
367 |
+
if ($tlsOptions) {
|
368 |
+
$this->setTlsOptions($tlsOptions);
|
369 |
+
}
|
370 |
// PHP Redis extension support TLS/ACL AUTH since 5.3.0
|
371 |
+
$this->oldPhpRedis = (bool)version_compare(phpversion('redis'),'5.3.0','<');
|
372 |
if ((
|
373 |
+
$this->isTls
|
374 |
|| $this->authUsername !== null
|
375 |
)
|
376 |
+
&& !$this->standalone && $this->oldPhpRedis){
|
377 |
$this->standalone = true;
|
378 |
}
|
379 |
}
|
410 |
return $this->port;
|
411 |
}
|
412 |
|
413 |
+
/**
|
414 |
+
* @return bool
|
415 |
+
*/
|
416 |
+
public function isTls()
|
417 |
+
{
|
418 |
+
return $this->isTls;
|
419 |
+
}
|
420 |
+
|
421 |
/**
|
422 |
* Return the selected database
|
423 |
* @return int
|
468 |
$this->closeOnDestruct = $flag;
|
469 |
return $this;
|
470 |
}
|
471 |
+
|
472 |
+
public function setTlsOptions(array $tlsOptions)
|
473 |
+
{
|
474 |
+
if($this->connected) {
|
475 |
+
throw new CredisException('Cannot change TLS options after a connection has already been established.');
|
476 |
+
}
|
477 |
+
$this->tlsOptions = $tlsOptions;
|
478 |
+
}
|
479 |
+
|
480 |
protected function convertHost()
|
481 |
{
|
482 |
+
if (preg_match('#^(tcp|tls|ssl|tlsv\d(?:\.\d)?|unix)://(.+)$#', $this->host, $matches)) {
|
483 |
+
$this->isTls = strpos($matches[1], 'tls') === 0 || strpos($matches[1], 'ssl') === 0;
|
484 |
+
if($this->isTls || $matches[1] === 'tcp') {
|
485 |
$this->scheme = $matches[1];
|
486 |
if ( ! preg_match('#^([^:]+)(:([0-9]+))?(/(.+))?$#', $matches[2], $matches)) {
|
487 |
throw new CredisException('Invalid host format; expected '.$this->scheme.'://host[:port][/persistence_identifier]');
|
506 |
$this->scheme = 'tcp';
|
507 |
}
|
508 |
}
|
509 |
+
|
510 |
/**
|
511 |
* @throws CredisException
|
512 |
* @return Credis_Client
|
517 |
return $this;
|
518 |
}
|
519 |
$this->close(true);
|
520 |
+
$tlsOptions = $this->isTls ? $this->tlsOptions : [];
|
521 |
if ($this->standalone) {
|
522 |
$flags = STREAM_CLIENT_CONNECT;
|
523 |
$remote_socket = $this->port === NULL
|
528 |
$remote_socket .= '/'.$this->persistent;
|
529 |
$flags = $flags | STREAM_CLIENT_PERSISTENT;
|
530 |
}
|
531 |
+
if ($this->isTls) {
|
532 |
+
$tlsOptions = array_merge($tlsOptions, [
|
533 |
+
'capture_peer_cert' => true,
|
534 |
+
'capture_peer_cert_chain' => true,
|
535 |
+
'capture_session_meta' => true,
|
536 |
+
]);
|
537 |
+
}
|
538 |
+
|
539 |
+
// passing $context as null errors before php 8.0
|
540 |
+
$context = stream_context_create(['ssl' => $tlsOptions]);
|
541 |
+
|
542 |
+
$result = $this->redis = @stream_socket_client($remote_socket, $errno, $errstr, $this->timeout !== null ? $this->timeout : 2.5, $flags, $context);
|
543 |
+
|
544 |
+
if ($result && $this->isTls) {
|
545 |
+
$this->sslMeta = stream_context_get_options($context);
|
546 |
+
}
|
547 |
}
|
548 |
else {
|
549 |
if ( ! $this->redis) {
|
550 |
$this->redis = new Redis;
|
551 |
}
|
552 |
+
$socketTimeout = $this->timeout ?: 0.0;
|
553 |
try
|
554 |
{
|
555 |
+
if ($this->oldPhpRedis)
|
556 |
+
{
|
557 |
+
$result = $this->persistent
|
558 |
+
? $this->redis->pconnect($this->host, (int)$this->port, $socketTimeout, $this->persistent)
|
559 |
+
: $this->redis->connect($this->host, (int)$this->port, $socketTimeout);
|
560 |
+
}
|
561 |
+
else
|
562 |
+
{
|
563 |
+
// 7th argument is non-documented TLS options. But it only exists on the newer versions of phpredis
|
564 |
+
if ($tlsOptions) {
|
565 |
+
$context = ['stream' => $tlsOptions];
|
566 |
+
} else {
|
567 |
+
$context = [];
|
568 |
+
}
|
569 |
+
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
570 |
$result = $this->persistent
|
571 |
+
? $this->redis->pconnect($this->scheme.'://'.$this->host, (int)$this->port, $socketTimeout, $this->persistent, 0, 0.0, $context)
|
572 |
+
: $this->redis->connect($this->scheme.'://'.$this->host, (int)$this->port, $socketTimeout, null, 0, 0.0, $context);
|
573 |
+
}
|
574 |
}
|
575 |
catch(Exception $e)
|
576 |
{
|
589 |
}
|
590 |
$failures = $this->connectFailures;
|
591 |
$this->connectFailures = 0;
|
592 |
+
throw new CredisException(sprintf("Connection to Redis%s %s://%s failed after %s failures.%s",
|
593 |
+
$this->standalone ? ' standalone' : '',
|
594 |
+
$this->scheme,
|
595 |
+
$this->host.($this->port ? ':'.$this->port : ''),
|
596 |
+
$failures,
|
597 |
+
(isset($errno) && isset($errstr) ? "Last Error : ({$errno}) {$errstr}" : "")
|
598 |
+
));
|
599 |
}
|
600 |
|
601 |
$this->connectFailures = 0;
|
624 |
* Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout
|
625 |
* if not supported).
|
626 |
*
|
627 |
+
* @param float $timeout 0 (or -1) for no timeout, otherwise number of seconds
|
628 |
* @throws CredisException
|
629 |
* @return Credis_Client
|
630 |
*/
|
1258 |
break;
|
1259 |
case 'auth':
|
1260 |
// For phpredis pre-v5.3, the type signature is string, not array|string
|
1261 |
+
$args = $this->oldPhpRedis ? $args : array($args);
|
1262 |
break;
|
1263 |
default:
|
1264 |
// Flatten arguments
|
dependencies/colinmollenhour/credis/README.markdown
CHANGED
@@ -44,6 +44,14 @@ $redis = new Credis_Client(/* connection string */);
|
|
44 |
|
45 |
`tls://host[:port][/persistence_identifier]`
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
#### Enable transport level security (TLS)
|
48 |
|
49 |
Use TLS connection string `tls://127.0.0.1:6379` instead of TCP connection `tcp://127.0.0.1:6379` string in order to enable transport level security.
|
44 |
|
45 |
`tls://host[:port][/persistence_identifier]`
|
46 |
|
47 |
+
or
|
48 |
+
|
49 |
+
`tlsv1.2://host[:port][/persistence_identifier]`
|
50 |
+
|
51 |
+
Before php 7.2, `tls://` only supports TLSv1.0, either `ssl://` or `tlsv1.2` can be used to force TLSv1.2 support.
|
52 |
+
|
53 |
+
Recent versions of redis do not support the protocols/cyphers that older versions of php default to, which may result in cryptic connection failures.
|
54 |
+
|
55 |
#### Enable transport level security (TLS)
|
56 |
|
57 |
Use TLS connection string `tls://127.0.0.1:6379` instead of TCP connection `tcp://127.0.0.1:6379` string in order to enable transport level security.
|
dependencies/colinmollenhour/credis/Sentinel.php
CHANGED
@@ -52,22 +52,45 @@ class Credis_Sentinel
|
|
52 |
* @var string
|
53 |
*/
|
54 |
protected $_password = '';
|
55 |
-
|
56 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
* Connect with a Sentinel node. Sentinel will do the master and slave discovery
|
58 |
*
|
59 |
* @param Credis_Client $client
|
60 |
* @param string $password (deprecated - use setClientPassword)
|
61 |
* @throws CredisException
|
62 |
*/
|
63 |
-
public function __construct(Credis_Client $client, $password = NULL)
|
64 |
{
|
65 |
-
if(!$client instanceof Credis_Client){
|
66 |
-
throw new CredisException('Sentinel client should be an instance of Credis_Client');
|
67 |
-
}
|
68 |
$client->forceStandalone(); // SENTINEL command not currently supported by phpredis
|
69 |
$this->_client = $client;
|
70 |
$this->_password = $password;
|
|
|
71 |
$this->_timeout = NULL;
|
72 |
$this->_persistent = '';
|
73 |
$this->_db = 0;
|
@@ -121,6 +144,37 @@ class Credis_Sentinel
|
|
121 |
return $this;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
/**
|
125 |
* @return Credis_Sentinel
|
126 |
* @deprecated
|
@@ -144,7 +198,7 @@ class Credis_Sentinel
|
|
144 |
if(!isset($master[0]) || !isset($master[1])){
|
145 |
throw new CredisException('Master not found');
|
146 |
}
|
147 |
-
return new Credis_Client($master[0], $master[1], $this->_timeout, $this->_persistent, $this->_db, $this->_password);
|
148 |
}
|
149 |
|
150 |
/**
|
@@ -176,7 +230,7 @@ class Credis_Sentinel
|
|
176 |
throw new CredisException('Can\' retrieve slave status');
|
177 |
}
|
178 |
if(!strstr($slave[9],'s_down') && !strstr($slave[9],'disconnected')) {
|
179 |
-
$workingSlaves[] = new Credis_Client($slave[3], $slave[5], $this->_timeout, $this->_persistent, $this->_db, $this->_password);
|
180 |
}
|
181 |
}
|
182 |
return $workingSlaves;
|
@@ -307,7 +361,10 @@ class Credis_Sentinel
|
|
307 |
*/
|
308 |
public function slaves($name)
|
309 |
{
|
310 |
-
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
52 |
* @var string
|
53 |
*/
|
54 |
protected $_password = '';
|
|
|
55 |
/**
|
56 |
+
* Store the AUTH username used by Credis_Client instances (Redis v6+)
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
protected $_username = '';
|
60 |
+
/**
|
61 |
+
* @var null|float
|
62 |
+
*/
|
63 |
+
protected $_timeout;
|
64 |
+
/**
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $_persistent;
|
68 |
+
/**
|
69 |
+
* @var int
|
70 |
+
*/
|
71 |
+
protected $_db;
|
72 |
+
/**
|
73 |
+
* @var string|null
|
74 |
+
*/
|
75 |
+
protected $_replicaCmd = null;
|
76 |
+
/**
|
77 |
+
* @var string|null
|
78 |
+
*/
|
79 |
+
protected $_redisVersion = null;
|
80 |
+
|
81 |
+
/**
|
82 |
* Connect with a Sentinel node. Sentinel will do the master and slave discovery
|
83 |
*
|
84 |
* @param Credis_Client $client
|
85 |
* @param string $password (deprecated - use setClientPassword)
|
86 |
* @throws CredisException
|
87 |
*/
|
88 |
+
public function __construct(Credis_Client $client, $password = NULL, $username = NULL)
|
89 |
{
|
|
|
|
|
|
|
90 |
$client->forceStandalone(); // SENTINEL command not currently supported by phpredis
|
91 |
$this->_client = $client;
|
92 |
$this->_password = $password;
|
93 |
+
$this->_username = $username;
|
94 |
$this->_timeout = NULL;
|
95 |
$this->_persistent = '';
|
96 |
$this->_db = 0;
|
144 |
return $this;
|
145 |
}
|
146 |
|
147 |
+
/**
|
148 |
+
* @param null|string $username
|
149 |
+
* @return $this
|
150 |
+
*/
|
151 |
+
public function setClientUsername($username)
|
152 |
+
{
|
153 |
+
$this->_username = $username;
|
154 |
+
return $this;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @param null|string $replicaCmd
|
159 |
+
* @return $this
|
160 |
+
*/
|
161 |
+
public function setReplicaCommand($replicaCmd)
|
162 |
+
{
|
163 |
+
$this->_replicaCmd = $replicaCmd;
|
164 |
+
return $this;
|
165 |
+
}
|
166 |
+
|
167 |
+
public function detectRedisVersion()
|
168 |
+
{
|
169 |
+
if ($this->_redisVersion !== null && $this->_replicaCmd !== null) {
|
170 |
+
return;
|
171 |
+
}
|
172 |
+
$serverInfo = $this->info('server');
|
173 |
+
$this->_redisVersion = $serverInfo['redis_version'];
|
174 |
+
// Redis v7+ renames the replica command to 'replicas' instead of 'slaves'
|
175 |
+
$this->_replicaCmd = version_compare($this->_redisVersion, '7.0.0', '>=') ? 'replicas' : 'slaves';
|
176 |
+
}
|
177 |
+
|
178 |
/**
|
179 |
* @return Credis_Sentinel
|
180 |
* @deprecated
|
198 |
if(!isset($master[0]) || !isset($master[1])){
|
199 |
throw new CredisException('Master not found');
|
200 |
}
|
201 |
+
return new Credis_Client($master[0], $master[1], $this->_timeout, $this->_persistent, $this->_db, $this->_password, $this->_username);
|
202 |
}
|
203 |
|
204 |
/**
|
230 |
throw new CredisException('Can\' retrieve slave status');
|
231 |
}
|
232 |
if(!strstr($slave[9],'s_down') && !strstr($slave[9],'disconnected')) {
|
233 |
+
$workingSlaves[] = new Credis_Client($slave[3], $slave[5], $this->_timeout, $this->_persistent, $this->_db, $this->_password, $this->_username);
|
234 |
}
|
235 |
}
|
236 |
return $workingSlaves;
|
361 |
*/
|
362 |
public function slaves($name)
|
363 |
{
|
364 |
+
if ($this->_replicaCmd === null) {
|
365 |
+
$this->detectRedisVersion();
|
366 |
+
}
|
367 |
+
return $this->_client->sentinel($this->_replicaCmd,$name);
|
368 |
}
|
369 |
|
370 |
/**
|
dependencies/predis/predis/CHANGELOG.md
CHANGED
@@ -1,1109 +1,129 @@
|
|
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 |
-
|
35 |
-
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
-
|
111 |
-
|
112 |
-
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
do not understand the `AUTH` and `SELECT` commands) (PR #346).
|
131 |
-
|
132 |
-
- __FIX__: when a sentinel instance reports no sentinel for a service, invoking
|
133 |
-
`connect()` on the redis-sentinel connection backend should fall back to the
|
134 |
-
master connection instead of failing (ISSUE #342).
|
135 |
-
|
136 |
-
- __FIX__: the two connection backends based on ext-phpiredis has some kind of
|
137 |
-
issues with the GC and the internal use of closures as reader callbacks that
|
138 |
-
prevented connections going out of scope from being properly collected and the
|
139 |
-
underlying stream or socket resources from being closed and freed. This should
|
140 |
-
not have had any actual effect in real-world scenarios due to the lifecycle of
|
141 |
-
PHP scripts, but we fixed it anyway (ISSUE #345).
|
142 |
-
|
143 |
-
|
144 |
-
v1.1.0 (2016-06-02)
|
145 |
-
================================================================================
|
146 |
-
|
147 |
-
- The default server profile for the client now targets Redis 3.2.
|
148 |
-
|
149 |
-
- Responses to the following commands are not casted into booleans anymore, the
|
150 |
-
original integer value is returned: `SETNX`, `MSETNX`, `SMOVE`, `SISMEMBER`,
|
151 |
-
`HSET`, `HSETNX`, `HEXISTS`, `PFADD`, `EXISTS`, `MOVE`, `PERSIST`, `EXPIRE`,
|
152 |
-
`EXPIREAT`, `RENAMENX`. This change does not have a significant impact unless
|
153 |
-
when using strict comparisons (=== and !==) the returned value.
|
154 |
-
|
155 |
-
- Non-boolean string values passed to the `persistent` connection parameter can
|
156 |
-
be used to create different persistent connections. Note that this feature was
|
157 |
-
already present in Predis but required both `persistent` and `path` to be set
|
158 |
-
as illustrated by [#139](https://github.com/nrk/predis/pull/139). This change
|
159 |
-
is needed to prevent confusion with how `path` is used to select a database
|
160 |
-
when using the `redis` scheme.
|
161 |
-
|
162 |
-
- The client throws exceptions when Redis returns any kind of error response to
|
163 |
-
initialization commands (the ones being automatically sent when a connection
|
164 |
-
is established, such as `SELECT` and `AUTH` when database and password are set
|
165 |
-
in connection parameters) regardless of the value of the exception option.
|
166 |
-
|
167 |
-
- Using `unix:///path/to/socket` in URI strings to specify a UNIX domain socket
|
168 |
-
file is now deprecated in favor of the format `unix:/path/to/socket` (note the
|
169 |
-
lack of the double slash after the scheme) and will not be supported starting
|
170 |
-
with the next major release.
|
171 |
-
|
172 |
-
- Implemented full support for redis-sentinel.
|
173 |
-
|
174 |
-
- Implemented the ability to specify default connection parameters for aggregate
|
175 |
-
connections with the new `parameters` client option. These parameters augment
|
176 |
-
the usual user-supplied connection parameters (but do not take the precedence
|
177 |
-
over them) when creating new connections and they are mostly useful when the
|
178 |
-
client is using aggregate connections such as redis-cluster and redis-sentinel
|
179 |
-
as these backends can create new connections on the fly based on responses and
|
180 |
-
redirections from Redis.
|
181 |
-
|
182 |
-
- Redis servers protected by SSL-encrypted connections can be accessed by using
|
183 |
-
the `tls` or `rediss` scheme in connection parameters along with SSL-specific
|
184 |
-
options in the `ssl` parameter (see http://php.net/manual/context.ssl.php).
|
185 |
-
|
186 |
-
- `Predis\Client` implements `IteratorAggregate` making it possible to iterate
|
187 |
-
over traversable aggregate connections and get a new client instance for each
|
188 |
-
Redis node.
|
189 |
-
|
190 |
-
- Iterating over an instance of `Predis\Connection\Aggregate\RedisCluster` will
|
191 |
-
return all the connections mapped in the slots map instead of just the ones in
|
192 |
-
the pool. This change makes it possible, when the slots map is retrieved from
|
193 |
-
Redis, to iterate over all of the master nodes in the cluster. When the use of
|
194 |
-
`CLUSTER SLOTS` is disabled via the `useClusterSlots()` method, the iteration
|
195 |
-
returns only the connections with slots ranges associated in their parameters
|
196 |
-
or the ones initialized by `-MOVED` responses in order to make the behaviour
|
197 |
-
of the iteration consistent between the two modes of operation.
|
198 |
-
|
199 |
-
- Various improvements to `Predis\Connection\Aggregate\MasterSlaveReplication`
|
200 |
-
(the "basic" replication backend, not the new one based on redis-sentinel):
|
201 |
-
|
202 |
-
- When the client is not able to send a read-only command to a slave because
|
203 |
-
the current connection fails or the slave is resyncing (`-LOADING` response
|
204 |
-
returned by Redis), the backend discards the failed connection and performs
|
205 |
-
a new attempt on the next slave. When no other slave is available the master
|
206 |
-
server is used for read-only commands as last resort.
|
207 |
-
|
208 |
-
- It is possible to discover the current replication configuration on the fly
|
209 |
-
by invoking the `discover()` method which internally relies on the output of
|
210 |
-
the command `INFO REPLICATION` executed against the master server or one of
|
211 |
-
the slaves. The backend can also be configured to do this automatically when
|
212 |
-
it fails to reach one of the servers.
|
213 |
-
|
214 |
-
- Implemented the `switchToMaster()` and `switchToSlave()` methods to make it
|
215 |
-
easier to force a switch to the master server or a random slave when needed.
|
216 |
-
|
217 |
-
|
218 |
-
v1.0.4 (2016-05-30)
|
219 |
-
================================================================================
|
220 |
-
|
221 |
-
- Added new profile for Redis 3.2 with its new commands: `HSTRLEN`, `BITFIELD`,
|
222 |
-
`GEOADD`, `GEOHASH`, `GEOPOS`, `GEODIST`, `GEORADIUS`, `GEORADIUSBYMEMBER`.
|
223 |
-
The default server profile for Predis is still the one for Redis 3.0 you must
|
224 |
-
set the `profile` client option to `3.2` when initializing the client in order
|
225 |
-
to be able to use them when connecting to Redis 3.2.
|
226 |
-
|
227 |
-
- Various improvements in the handling of redis-cluster:
|
228 |
-
|
229 |
-
- If the connection to a specific node fails when executing a command, the
|
230 |
-
client tries to connect to another node in order to refresh the slots map
|
231 |
-
and perform a new attempt to execute the command.
|
232 |
-
|
233 |
-
- Connections to nodes can be preassigned to non-contiguous slot ranges via
|
234 |
-
the `slots` parameter using a comma separator. This is how it looks like
|
235 |
-
in practice: `tcp://127.0.0.1:6379?slots=0-5460,5500-5600,11000`.
|
236 |
-
|
237 |
-
- __FIX__: broken values returned by `Predis\Collection\Iterator\HashKey` when
|
238 |
-
iterating hash keys containing integer fields (PR #330, ISSUE #331).
|
239 |
-
|
240 |
-
- __FIX__: prevent failures when `Predis\Connection\StreamConnection` serializes
|
241 |
-
commands with holes in their arguments (e.g. `[0 => 'key:0', 2 => 'key:2']`).
|
242 |
-
The same fix has been applied to `Predis\Protocol\Text\RequestSerializer`.
|
243 |
-
(ISSUE #316).
|
244 |
-
|
245 |
-
|
246 |
-
v1.0.3 (2015-07-30)
|
247 |
-
================================================================================
|
248 |
-
|
249 |
-
- __FIX__: the previous release introduced a severe regression on HHVM that made
|
250 |
-
the library unable to connect to Redis when using IPv4 addresses. Code running
|
251 |
-
on the standard PHP interpreter is not affected.
|
252 |
-
|
253 |
-
|
254 |
-
v1.0.2 (2015-07-30)
|
255 |
-
================================================================================
|
256 |
-
|
257 |
-
- IPv6 is now fully supported.
|
258 |
-
|
259 |
-
- Added `redis` as an accepted scheme for connection parameters. When using this
|
260 |
-
scheme, the rules used to parse URI strings match the provisional registration
|
261 |
-
[published by IANA](http://www.iana.org/assignments/uri-schemes/prov/redis).
|
262 |
-
|
263 |
-
- Added new or missing commands: `HSTRLEN` (>= 3.2), `ZREVRANGEBYLEX` (>= 2.8)
|
264 |
-
and `MIGRATE` (>= 2.6).
|
265 |
-
|
266 |
-
- Implemented support for the `ZADD` modifiers `NX|XX`, `CH`, `INCR` (Redis >=
|
267 |
-
3.0.2) using the simplified signature where scores and members are passed as
|
268 |
-
a named array.
|
269 |
-
|
270 |
-
- __FIX__: `Predis\Configuration\Options` must not trigger the autoloader when
|
271 |
-
option values are strings (ISSUE #257).
|
272 |
-
|
273 |
-
- __FIX__: `BITPOS` was not defined in the key-prefix processor (ISSUE #265) and
|
274 |
-
in the replication strategy.
|
275 |
-
|
276 |
-
|
277 |
-
v1.0.1 (2015-01-02)
|
278 |
-
================================================================================
|
279 |
-
|
280 |
-
- Added `BITPOS` to the server profile for Redis 2.8.
|
281 |
-
|
282 |
-
- Connection timeout for read/write operations can now be set for UNIX sockets
|
283 |
-
where the underlying connection uses PHP's stream.
|
284 |
-
|
285 |
-
- __FIX__: broken values returned by `Predis\Collection\Iterator\SortedSetKey`
|
286 |
-
when iterating sorted set containing integer members (ISSUE #216).
|
287 |
-
|
288 |
-
- __FIX__: applied a minor workaround for a bug in old versions of PHP < 5.3.9
|
289 |
-
affecting inheritance.
|
290 |
-
|
291 |
-
- __FIX__: prevent E_NOTICE warnings when using INFO [section] returns an empty
|
292 |
-
response due to an unsupported specific set of information requested to Redis.
|
293 |
-
|
294 |
-
|
295 |
-
v1.0.0 (2014-08-01)
|
296 |
-
================================================================================
|
297 |
-
|
298 |
-
- Switched to PSR-4 for autoloading.
|
299 |
-
|
300 |
-
- The default server profile for Redis is `3.0`.
|
301 |
-
|
302 |
-
- Removed server profile for Redis 1.2.
|
303 |
-
|
304 |
-
- Added `SENTINEL` to the profile for Redis 2.6 and `PUBSUB` to the profile for
|
305 |
-
Redis 2.8.
|
306 |
-
|
307 |
-
- `Predis\Client` can now send raw commands using `Predis\Client::executeRaw()`.
|
308 |
-
|
309 |
-
- Status responses are returned as instances of `Predis\Response\Status`, for
|
310 |
-
example +OK is not returned as boolean TRUE anymore which is a breaking change
|
311 |
-
for those using strict comparisons. Status responses can be casted to string
|
312 |
-
values carrying the original payload, so one can do `$response == 'OK'` which
|
313 |
-
is also more akin to how Redis replies to clients.
|
314 |
-
|
315 |
-
- Commands `ZRANGE`, `ZRANGEBYSCORE`, `ZREVRANGE` and `ZREVRANGEBYSCORE` using
|
316 |
-
`WITHSCORE` return a named array of member => score instead of using an array
|
317 |
-
of [member, score] elements. Insertion order is preserved anyway due to how
|
318 |
-
PHP works internally.
|
319 |
-
|
320 |
-
- The command `ZSCAN` returns a named array of member => score instead of using
|
321 |
-
an array of [member, score] elements. Insertion order is preserved anyway due
|
322 |
-
to how PHP works internally.
|
323 |
-
|
324 |
-
- The rules for redis-cluster are now leveraged for empty key tags when using
|
325 |
-
client-side sharding, which means that when one or the first occurrence of {}
|
326 |
-
is found in a key it will most likely produce a different hash than previous
|
327 |
-
versions of Predis thus leading to a different partitioning in these cases.
|
328 |
-
|
329 |
-
- Invoking `Predis\Client::connect()` when the underlying connection has been
|
330 |
-
already established does not throw any exception anymore, now the connection
|
331 |
-
simply does not attempt to perform any operation.
|
332 |
-
|
333 |
-
- Added the `aggregate` client option, useful to fully customize how the client
|
334 |
-
should aggregate multiple connections when an array of connection parameters
|
335 |
-
is passed to `Predis\Client::__construct()`.
|
336 |
-
|
337 |
-
- Dropped support for streamable multibulk responses. Actually we still ship the
|
338 |
-
iterator response classes just in case anyone would want to build custom stuff
|
339 |
-
at a level lower than the client abstraction (our standard and composable text
|
340 |
-
protocol processors still handle them and can be used as an example).
|
341 |
-
|
342 |
-
- Simplified the implementation of connection parameters by removing method used
|
343 |
-
to cast to int / bool / float certain parameters supplied by users. Casting
|
344 |
-
values, if deemed necessary, should be done by the consumer or you can just
|
345 |
-
subclass `Predis\Connection\Parameters` and override the `filter()` method.
|
346 |
-
|
347 |
-
- Changed a couple of options for our transaction abstraction:
|
348 |
-
|
349 |
-
- `exceptions`: overrides the value of the client option with the same name.
|
350 |
-
Please note that it does not affect all the transaction control commands
|
351 |
-
such as `MULTI`, `EXEC`, `DISCARD`, `WATCH` and `UNWATCH`.
|
352 |
-
- `on_retry`: this option has been removed.
|
353 |
-
|
354 |
-
- Removed pipeline executors, now command pipelines can be easily customized by
|
355 |
-
extending the standard `Predis\Pipeline\Pipeline` class. Accepted options when
|
356 |
-
creating a pipeline using `Predis\Client::pipeline()` are:
|
357 |
-
|
358 |
-
- `atomic`: returns a pipeline wrapped in a MULTI / EXEC transaction
|
359 |
-
(class: `Predis\Pipeline\Atomic`).
|
360 |
-
- `fire-and-forget`: returns a pipeline that does not read back responses
|
361 |
-
(class: `Predis\Pipeline\FireAndForget`).
|
362 |
-
|
363 |
-
- Renamed the two base abstract command classes:
|
364 |
-
|
365 |
-
- `Predis\Command\AbstractCommand` is now `Predis\Command\Command`
|
366 |
-
- `Predis\Command\ScriptedCommand` is now `Predis\Command\ScriptCommand`
|
367 |
-
|
368 |
-
- Dropped `Predis\Command\Command::__toString()` (see issue #151).
|
369 |
-
|
370 |
-
- The key prefixing logic has been moved from command classes to the key prefix
|
371 |
-
processor. Developers can define or override handlers used to prefix keys, but
|
372 |
-
they can also define the needed logic in their command classes by implementing
|
373 |
-
`Predis\Command\PrefixableCommandInterface` just like before.
|
374 |
-
|
375 |
-
- `Predis\PubSub\DispatcherLoop` now takes a `Predis\PubSub\Consumer` instance
|
376 |
-
as the sole argument of its constructor instead of `Predis\ClientInterface`.
|
377 |
-
|
378 |
-
- All of the interfaces and classes related to translated Redis response types
|
379 |
-
have been moved in the new `Predis\Response` namespace and most of them have
|
380 |
-
been renamed to make their fully-qualified name less redundant. Now the base
|
381 |
-
response interface is `Predis\Response\ResponseInterface`.
|
382 |
-
|
383 |
-
- Renamed interface `Predis\Command\Processor\CommandProcessorInterface` to a
|
384 |
-
shorter `Predis\Command\Processor\ProcessorInterface`. Also removed interface
|
385 |
-
for chain processors since it is basically useless.
|
386 |
-
|
387 |
-
- Renamed `Predis\ExecutableContextInterface` to `Predis\ClientContextInterface`
|
388 |
-
and augmented it with a couple of required methods since this interface is no
|
389 |
-
more comparable to a basic client as it could be misleading.
|
390 |
-
|
391 |
-
- The `Predis\Option` namespace is now known as `Predis\Configuration` and have
|
392 |
-
a fully-reworked `Options` class with the ability to lazily initialize values
|
393 |
-
using objects that responds to `__invoke()` (not all the kinds of callables)
|
394 |
-
even for custom options defined by the user.
|
395 |
-
|
396 |
-
- Renamed `Predis\Connection\ConnectionInterface::writeCommand()` into
|
397 |
-
`writeRequest()` for consistency with its counterpart, `readResponse()`.
|
398 |
-
|
399 |
-
- Renamed `Predis\Connection\SingleConnectionInterface::pushInitCommand()` into
|
400 |
-
`addConnectCommand()` which is more obvious.
|
401 |
-
|
402 |
-
- Renamed the connection class based on both ext-phpiredis and ext-socket into
|
403 |
-
`Predis\Connection\PhpiredisSocketConnection`. The one based on PHP's streams
|
404 |
-
is still named `Predis\Connection\PhpiredisStreamConnection`.
|
405 |
-
|
406 |
-
- Renamed the connection factory class to `Predis\Connection\Factory`. Now its
|
407 |
-
constructor does not require anymore a profile instance to create `AUTH` and
|
408 |
-
`SELECT` commands when parameters contain both `password` and `database`. Raw
|
409 |
-
commands will be used instead.
|
410 |
-
|
411 |
-
- Renamed the connection parameters class to `Predis\Connection\Parameters`. Now
|
412 |
-
its constructor accepts only named arrays, but instances can still be created
|
413 |
-
using both URIs or arrays using the static method `Parameters::create()`.
|
414 |
-
|
415 |
-
- The profile factory code has been extracted from the abstract Redis profile
|
416 |
-
class and now lives in `Predis\Profile\Factory`.
|
417 |
-
|
418 |
-
- The `Predis\Connection` namespace has been completely reorganized by renaming
|
419 |
-
a few classes and interfaces and adding some sub-namespaces.
|
420 |
-
|
421 |
-
- Most classes and interfaces in the `Predis\Protocol` namespace have been moved
|
422 |
-
or renamed while rationalizing the whole API for external protocol processors.
|
423 |
-
|
424 |
-
|
425 |
-
v0.8.7 (2014-08-01)
|
426 |
-
================================================================================
|
427 |
-
|
428 |
-
- Added `3.0` in the server profiles aliases list for Redis 3.0. `2.8` is still
|
429 |
-
the default server profile and `dev` still targets Redis 3.0.
|
430 |
-
|
431 |
-
- Added `COMMAND` to the server profile for Redis 2.8.
|
432 |
-
|
433 |
-
- Switched internally to the `CLUSTER SLOTS` command instead of `CLUSTER NODES`
|
434 |
-
to fetch the updated slots map from redis-cluster. This change requires users
|
435 |
-
to upgrade Redis nodes to >= 3.0.0b7.
|
436 |
-
|
437 |
-
- The updated slots map is now fetched automatically from redis-cluster upon the
|
438 |
-
first `-MOVED` response by default. This change makes it possible to feed the
|
439 |
-
client constructor with only a few nodes of the actual cluster composition,
|
440 |
-
without needing a more complex configuration.
|
441 |
-
|
442 |
-
- Implemented support for `PING` in PUB/SUB loop for Redis >= 3.0.0b8.
|
443 |
-
|
444 |
-
- The default client-side sharding strategy and the one for redis-cluster now
|
445 |
-
share the same implementations as they follow the same rules. One difference,
|
446 |
-
aside from the different hashing function used to calculate distribution, is
|
447 |
-
in how empty hash tags like {} are treated by redis-cluster.
|
448 |
-
|
449 |
-
- __FIX__: the patch applied to fix #180 introduced a regression affecting read/
|
450 |
-
write timeouts in `Predis\Connection\PhpiredisStreamConnection`. Unfortunately
|
451 |
-
the only possible solution requires PHP 5.4+. On PHP 5.3, read/write timeouts
|
452 |
-
will be ignored from now on.
|
453 |
-
|
454 |
-
|
455 |
-
v0.8.6 (2014-07-15)
|
456 |
-
================================================================================
|
457 |
-
|
458 |
-
- Redis 2.8 is now the default server profile as there are no changes that would
|
459 |
-
break compatibility with previous releases.
|
460 |
-
|
461 |
-
- Added `PFADD`, `PFCOUNT`, `PFMERGE` to the server profile for Redis 2.8 for
|
462 |
-
handling the HyperLogLog data structure introduced in Redis 2.8.9.
|
463 |
-
|
464 |
-
- Added `ZLEXCOUNT`, `ZRANGEBYLEX`, `ZREMRANGEBYLEX` to the server profile for
|
465 |
-
Redis 2.8 for handling lexicographic operations on members of sorted sets.
|
466 |
-
|
467 |
-
- Added support for key hash tags when using redis-cluster (Redis 3.0.0b1).
|
468 |
-
|
469 |
-
- __FIX__: minor tweaks to make Predis compatible with HHVM >= 2.4.0.
|
470 |
-
|
471 |
-
- __FIX__: responses to `INFO` are now properly parsed and will not break when
|
472 |
-
redis sentinel is being used (ISSUE #154).
|
473 |
-
|
474 |
-
- __FIX__: added missing support for `INCRBYFLOAT` in cluster and replication
|
475 |
-
configurations (ISSUE #159).
|
476 |
-
|
477 |
-
- __FIX__: fix parsing of the output of `CLUSTER NODES` to fetch the slots map
|
478 |
-
from a node when redis-cluster has slaves in its configuration (ISSUE #165).
|
479 |
-
|
480 |
-
- __FIX__: prevent a stack overflow when iterating over large Redis collections
|
481 |
-
using our abstraction for cursor-based iterators (ISSUE #182).
|
482 |
-
|
483 |
-
- __FIX__: properly discards transactions when the server immediately returns an
|
484 |
-
error response (e.g. -OOM or -ERR on invalid arguments for a command) instead
|
485 |
-
of a +QUEUED response (ISSUE #187).
|
486 |
-
|
487 |
-
- Upgraded to PHPUnit 4.* for the test suite.
|
488 |
-
|
489 |
-
|
490 |
-
v0.8.5 (2014-01-16)
|
491 |
-
================================================================================
|
492 |
-
|
493 |
-
- Added `2.8` in the server profiles aliases list for Redis 2.8. `2.6` is still
|
494 |
-
the default server profile and `dev` now targets Redis 3.0.
|
495 |
-
|
496 |
-
- Added `SCAN`, `SSCAN`, `ZSCAN`, `HSCAN` to the server profile for Redis 2.8.
|
497 |
-
|
498 |
-
- Implemented PHP iterators for incremental iterations over Redis collections:
|
499 |
-
|
500 |
-
- keyspace (cursor-based iterator using `SCAN`)
|
501 |
-
- sets (cursor-based iterator using `SSCAN`)
|
502 |
-
- sorted sets (cursor-based iterator using `ZSCAN`)
|
503 |
-
- hashes (cursor-based iterator using `HSCAN`)
|
504 |
-
- lists (plain iterator using `LRANGE`)
|
505 |
-
|
506 |
-
- It is now possible to execute "raw commands" using `Predis\Command\RawCommand`
|
507 |
-
and a variable list of command arguments. Input arguments are not filtered and
|
508 |
-
responses are not parsed, which means arguments must follow the signature of
|
509 |
-
the command as defined by Redis and complex responses are left untouched.
|
510 |
-
|
511 |
-
- URI parsing for connection parameters has been improved and has slightly less
|
512 |
-
overhead when the number of fields in the querystring grows. New features are:
|
513 |
-
|
514 |
-
- Parsing does not break when value of a field contains one or more "=".
|
515 |
-
- Repeated fieldnames using [] produce an array of values.
|
516 |
-
- Empty or incomplete "key=value" pairs result in an empty string for "key".
|
517 |
-
|
518 |
-
- Various improvements and fixes to the redis-cluster connection backend:
|
519 |
-
|
520 |
-
- __FIX__: the `ASKING` command is sent upon -ASK redirections.
|
521 |
-
- An updated slots-map can be fetched from nodes using the `CLUSTER NODES`
|
522 |
-
command. By default this is a manual operation but can be enabled to get
|
523 |
-
automatically done upon -MOVED redirections.
|
524 |
-
- It is possible to specify a common set of connection parameters that are
|
525 |
-
applied to connections created on the fly upon redirections to nodes not
|
526 |
-
part of the initial pool.
|
527 |
-
|
528 |
-
- List of deprecated methods:
|
529 |
-
|
530 |
-
- `Predis\Client::multiExec()`: superseded by `Predis\Client::transaction()`
|
531 |
-
and to be removed in the next major release.
|
532 |
-
- `Predis\Client::pubSub()`: superseded by `Predis\Client::pubSubLoop()` and
|
533 |
-
to be removed in the next major release. This change was needed due to the
|
534 |
-
recently introduced `PUBSUB` command in Redis 2.8.
|
535 |
-
|
536 |
-
|
537 |
-
v0.8.4 (2013-07-27)
|
538 |
-
================================================================================
|
539 |
-
|
540 |
-
- Added `DUMP` and `RESTORE` to the server profile for Redis 2.6.
|
541 |
-
|
542 |
-
- Connection exceptions now report basic host details in their messages.
|
543 |
-
|
544 |
-
- Allow `Predis\Connection\PhpiredisConnection` to use a random IP when a host
|
545 |
-
actually has several IPs (ISSUE #116).
|
546 |
-
|
547 |
-
- __FIX__: allow `HMSET` when using a cluster of Redis nodes with client-side
|
548 |
-
sharding or redis-cluster (ISSUE #106).
|
549 |
-
|
550 |
-
- __FIX__: set `WITHSCORES` modifer for `ZRANGE`, `ZREVRANGE`, `ZRANGEBYSCORE`
|
551 |
-
and `ZREVRANGEBYSCORE` only when the options array passed to these commands
|
552 |
-
has `WITHSCORES` set to `true` (ISSUE #107).
|
553 |
-
|
554 |
-
- __FIX__: scripted commands falling back from `EVALSHA` to `EVAL` resulted in
|
555 |
-
PHP errors when using a prefixed client (ISSUE #109).
|
556 |
-
|
557 |
-
- __FIX__: `Predis\PubSub\DispatcherLoop` now works properly when using key
|
558 |
-
prefixing (ISSUE #114).
|
559 |
-
|
560 |
-
|
561 |
-
v0.8.3 (2013-02-18)
|
562 |
-
================================================================================
|
563 |
-
|
564 |
-
- Added `CLIENT SETNAME` and `CLIENT GETNAME` (ISSUE #102).
|
565 |
-
|
566 |
-
- Implemented the `Predis\Connection\PhpiredisStreamConnection` class using the
|
567 |
-
`phpiredis` extension like `Predis\Connection\PhpiredisStreamConnection`, but
|
568 |
-
without requiring the `socket` extension since it relies on PHP's streams.
|
569 |
-
|
570 |
-
- Added support for the TCP_NODELAY flag via the `tcp_nodelay` parameter for
|
571 |
-
stream-based connections, namely `Predis\Connection\StreamConnection` and
|
572 |
-
`Predis\Connection\PhpiredisStreamConnection` (requires PHP >= 5.4.0).
|
573 |
-
|
574 |
-
- Updated the aggregated connection class for redis-cluster to work with 16384
|
575 |
-
hash slots instead of 4096 to reflect the recent change from redis unstable
|
576 |
-
([see this commit](https://github.com/antirez/redis/commit/ebd666d)).
|
577 |
-
|
578 |
-
- The constructor of `Predis\Client` now accepts a callable as first argument
|
579 |
-
returning `Predis\Connection\ConnectionInterface`. Users can create their
|
580 |
-
own self-contained strategies to create and set up the underlying connection.
|
581 |
-
|
582 |
-
- Users should return `0` from `Predis\Command\ScriptedCommand::getKeysCount()`
|
583 |
-
instead of `FALSE` to indicate that all of the arguments of a Lua script must
|
584 |
-
be used to populate `ARGV[]`. This does not represent a breaking change.
|
585 |
-
|
586 |
-
- The `Predis\Helpers` class has been deprecated and it will be removed in
|
587 |
-
future releases.
|
588 |
-
|
589 |
-
|
590 |
-
v0.8.2 (2013-02-03)
|
591 |
-
================================================================================
|
592 |
-
|
593 |
-
- Added `Predis\Session\SessionHandler` to make it easy to store PHP sessions
|
594 |
-
on Redis using Predis. Please note that this class needs either PHP >= 5.4.0
|
595 |
-
or a polyfill for PHP's `SessionHandlerInterface`.
|
596 |
-
|
597 |
-
- Added the ability to get the default value of a client option directly from
|
598 |
-
`Predis\Option\ClientOption` using the `getDefault()` method by passing the
|
599 |
-
option name or its instance.
|
600 |
-
|
601 |
-
- __FIX__: the standard pipeline executor was not using the response parser
|
602 |
-
methods associated to commands to process raw responses (ISSUE #101).
|
603 |
-
|
604 |
-
|
605 |
-
v0.8.1 (2013-01-19)
|
606 |
-
================================================================================
|
607 |
-
|
608 |
-
- The `connections` client option can now accept a callable object returning
|
609 |
-
an instance of `Predis\Connection\ConnectionFactoryInterface`.
|
610 |
-
|
611 |
-
- Client options accepting callable objects as factories now pass their actual
|
612 |
-
instance to the callable as the second argument.
|
613 |
-
|
614 |
-
- `Predis\Command\Processor\KeyPrefixProcessor` can now be directly casted to
|
615 |
-
string to obtain the current prefix, useful with string interpolation.
|
616 |
-
|
617 |
-
- Added an optional callable argument to `Predis\Cluster\Distribution\HashRing`
|
618 |
-
and `Predis\Cluster\Distribution\KetamaPureRing` constructor that can be used
|
619 |
-
to customize how the distributor should extract the connection hash when
|
620 |
-
initializing the nodes distribution (ISSUE #36).
|
621 |
-
|
622 |
-
- Correctly handle `TTL` and `PTTL` returning -2 on non existing keys starting
|
623 |
-
with Redis 2.8.
|
624 |
-
|
625 |
-
- __FIX__: a missing use directive in `Predis\Transaction\MultiExecContext`
|
626 |
-
caused PHP errors when Redis did not return `+QUEUED` replies to commands
|
627 |
-
when inside a MULTI / EXEC context.
|
628 |
-
|
629 |
-
- __FIX__: the `parseResponse()` method implemented for a scripted command was
|
630 |
-
ignored when retrying to execute a Lua script by falling back to `EVAL` after
|
631 |
-
a `-NOSCRIPT` error (ISSUE #94).
|
632 |
-
|
633 |
-
- __FIX__: when subclassing `Predis\Client` the `getClientFor()` method returns
|
634 |
-
a new instance of the subclass instead of a new instance of `Predis\Client`.
|
635 |
-
|
636 |
-
|
637 |
-
v0.8.0 (2012-10-23)
|
638 |
-
================================================================================
|
639 |
-
|
640 |
-
- The default server profile for Redis is now `2.6`.
|
641 |
-
|
642 |
-
- Certain connection parameters have been renamed:
|
643 |
-
|
644 |
-
- `connection_async` is now `async_connect`
|
645 |
-
- `connection_timeout` is now `timeout`
|
646 |
-
- `connection_persistent` is now `persistent`
|
647 |
-
|
648 |
-
- The `throw_errors` connection parameter has been removed and replaced by the
|
649 |
-
new `exceptions` client option since exceptions on `-ERR` replies returned by
|
650 |
-
Redis are not generated by connection classes anymore but instead are thrown
|
651 |
-
by the client class and other abstractions such as pipeline contexts.
|
652 |
-
|
653 |
-
- Added smart support for redis-cluster (Redis v3.0) in addition to the usual
|
654 |
-
cluster implementation that uses client-side sharding.
|
655 |
-
|
656 |
-
- Various namespaces and classes have been renamed to follow rules inspired by
|
657 |
-
the Symfony2 naming conventions.
|
658 |
-
|
659 |
-
- The second argument of the constructor of `Predis\Client` does not accept
|
660 |
-
strings or instances of `Predis\Profile\ServerProfileInterface` anymore.
|
661 |
-
To specify a server profile you must explicitly set `profile` in the array
|
662 |
-
of client options.
|
663 |
-
|
664 |
-
- `Predis\Command\ScriptedCommand` internally relies on `EVALSHA` instead of
|
665 |
-
`EVAL` thus avoiding to send Lua scripts bodies on each request. The client
|
666 |
-
automatically resends the command falling back to `EVAL` when Redis returns a
|
667 |
-
`-NOSCRIPT` error. Automatic fallback to `EVAL` does not work with pipelines,
|
668 |
-
inside a `MULTI / EXEC` context or with plain `EVALSHA` commands.
|
669 |
-
|
670 |
-
- Complex responses are no more parsed by connection classes as they must be
|
671 |
-
processed by consumer classes using the handler associated to the issued
|
672 |
-
command. This means that executing commands directly on connections only
|
673 |
-
returns simple Redis types, but nothing changes when using `Predis\Client`
|
674 |
-
or the provided abstractions for pipelines and transactions.
|
675 |
-
|
676 |
-
- Iterators for multi-bulk replies now skip the response parsing method of the
|
677 |
-
command that generated the response and are passed directly to user code.
|
678 |
-
Pipeline and transaction objects still consume automatically iterators.
|
679 |
-
|
680 |
-
- Cluster and replication connections now extend a new common interface,
|
681 |
-
`Predis\Connection\AggregatedConnectionInterface`.
|
682 |
-
|
683 |
-
- `Predis\Connection\MasterSlaveReplication` now uses an external strategy
|
684 |
-
class to handle the logic for checking readable / writable commands and Lua
|
685 |
-
scripts.
|
686 |
-
|
687 |
-
- Command pipelines have been optimized for both speed and code cleanness, but
|
688 |
-
at the cost of bringing a breaking change in the signature of the interface
|
689 |
-
for pipeline executors.
|
690 |
-
|
691 |
-
- Added a new pipeline executor that sends commands wrapped in a MULTI / EXEC
|
692 |
-
context to make the execution atomic: if a pipeline fails at a certain point
|
693 |
-
then the whole pipeline is discarded.
|
694 |
-
|
695 |
-
- The key-hashing mechanism for commands is now handled externally and is no
|
696 |
-
more a competence of each command class. This change is neeeded to support
|
697 |
-
both client-side sharding and Redis cluster.
|
698 |
-
|
699 |
-
- `Predis\Options\Option` is now abstract, see `Predis\Option\AbstractOption`.
|
700 |
-
|
701 |
-
|
702 |
-
v0.7.3 (2012-06-01)
|
703 |
-
================================================================================
|
704 |
-
|
705 |
-
- New commands available in the Redis v2.6 profile (dev): `BITOP`, `BITCOUNT`.
|
706 |
-
|
707 |
-
- When the number of keys `Predis\Commands\ScriptedCommand` is negative, Predis
|
708 |
-
will count from the end of the arguments list to calculate the actual number
|
709 |
-
of keys that will be interpreted as elements for `KEYS` by the underlying
|
710 |
-
`EVAL` command.
|
711 |
-
|
712 |
-
- __FIX__: `examples\CustomDistributionStrategy.php` had a mistyped constructor
|
713 |
-
call and produced a bad distribution due to an error as pointed in ISSUE #63.
|
714 |
-
This bug is limited to the above mentioned example and does not affect the
|
715 |
-
classes implemented in the `Predis\Distribution` namespace.
|
716 |
-
|
717 |
-
- __FIX__: `Predis\Commands\ServerEvalSHA::getScriptHash()` was calculating the
|
718 |
-
hash while it just needs to return the first argument of the command.
|
719 |
-
|
720 |
-
- __FIX__: `Predis\Autoloader` has been modified to allow cascading autoloaders
|
721 |
-
for the `Predis` namespace.
|
722 |
-
|
723 |
-
|
724 |
-
v0.7.2 (2012-04-01)
|
725 |
-
================================================================================
|
726 |
-
|
727 |
-
- Added `2.6` in the server profiles aliases list for the upcoming Redis 2.6.
|
728 |
-
`2.4` is still the default server profile. `dev` now targets Redis 2.8.
|
729 |
-
|
730 |
-
- Connection instances can be serialized and unserialized using `serialize()`
|
731 |
-
and `unserialize()`. This is handy in certain scenarios such as client-side
|
732 |
-
clustering or replication to lower the overhead of initializing a connection
|
733 |
-
object with many sub-connections since unserializing them can be up to 5x
|
734 |
-
times faster.
|
735 |
-
|
736 |
-
- Reworked the default autoloader to make it faster. It is also possible to
|
737 |
-
prepend it in PHP's autoload stack.
|
738 |
-
|
739 |
-
- __FIX__: fixed parsing of the payload returned by `MONITOR` with Redis 2.6.
|
740 |
-
|
741 |
-
|
742 |
-
v0.7.1 (2011-12-27)
|
743 |
-
================================================================================
|
744 |
-
|
745 |
-
- The PEAR channel on PearHub has been deprecated in favour of `pear.nrk.io`.
|
746 |
-
|
747 |
-
- Miscellaneous minor fixes.
|
748 |
-
|
749 |
-
- Added transparent support for master / slave replication configurations where
|
750 |
-
write operations are performed on the master server and read operations are
|
751 |
-
routed to one of the slaves. Please refer to ISSUE #21 for a bit of history
|
752 |
-
and more details about replication support in Predis.
|
753 |
-
|
754 |
-
- The `profile` client option now accepts a callable object used to initialize
|
755 |
-
a new instance of `Predis\Profiles\IServerProfile`.
|
756 |
-
|
757 |
-
- Exposed a method for MULTI / EXEC contexts that adds the ability to execute
|
758 |
-
instances of Redis commands against transaction objects.
|
759 |
-
|
760 |
-
|
761 |
-
v0.7.0 (2011-12-11)
|
762 |
-
================================================================================
|
763 |
-
|
764 |
-
- Predis now adheres to the PSR-0 standard which means that there is no more a
|
765 |
-
single file holding all the classes of the library, but multiple files (one
|
766 |
-
for each class). You can use any PSR-0 compatible autoloader to load Predis
|
767 |
-
or just leverage the default one shipped with the library by requiring the
|
768 |
-
`Predis/Autoloader.php` and call `Predis\Autoloader::register()`.
|
769 |
-
|
770 |
-
- The default server profile for Redis is now 2.4. The `dev` profile supports
|
771 |
-
all the features of Redis 2.6 (currently unstable) such as Lua scripting.
|
772 |
-
|
773 |
-
- Support for long aliases (method names) for Redis commands has been dropped.
|
774 |
-
|
775 |
-
- Redis 1.0 is no more supported. From now on Predis will use only the unified
|
776 |
-
protocol to serialize commands.
|
777 |
-
|
778 |
-
- It is possible to prefix keys transparently on a client-level basis with the
|
779 |
-
new `prefix` client option.
|
780 |
-
|
781 |
-
- An external connection factory is used to initialize new connection instances
|
782 |
-
and developers can now register their own connection classes using the new
|
783 |
-
`connections` client option.
|
784 |
-
|
785 |
-
- It is possible to connect locally to Redis using UNIX domain sockets. Just
|
786 |
-
use `unix:///path/to/redis.sock` or a named array just like in the following
|
787 |
-
example: `array('scheme' => 'unix', 'path' => '/path/to/redis.sock');`.
|
788 |
-
|
789 |
-
- If the `phpiredis` extension is loaded by PHP, it is now possible to use an
|
790 |
-
alternative connection class that leverages it to make Predis faster on many
|
791 |
-
cases, especially when dealing with big multibulk replies, with the the only
|
792 |
-
downside that persistent connections are not supported. Please refer to the
|
793 |
-
documentation to see how to activate this class using the new `connections`
|
794 |
-
client option.
|
795 |
-
|
796 |
-
- Predis is capable to talk with Webdis, albeit with some limitations such as
|
797 |
-
the lack of pipelining and transactions, just by using the `http` scheme in
|
798 |
-
in the connection parameters. All is needed is PHP with the `curl` and the
|
799 |
-
`phpiredis` extensions loaded.
|
800 |
-
|
801 |
-
- Way too many changes in the public API to make a list here, we just tried to
|
802 |
-
make all the Redis commands compatible with previous releases of v0.6 so that
|
803 |
-
you do not have to worry if you are simply using Predis as a client. Probably
|
804 |
-
the only breaking changes that should be mentioned here are:
|
805 |
-
|
806 |
-
- `throw_on_error` has been renamed to `throw_errors` and it is a connection
|
807 |
-
parameter instead of a client option, along with `iterable_multibulk`.
|
808 |
-
|
809 |
-
- `key_distribution` has been removed from the client options. To customize
|
810 |
-
the distribution strategy you must provide a callable object to the new
|
811 |
-
`cluster` client option to configure and then return a new instance of
|
812 |
-
`Predis\Network\IConnectionCluster`.
|
813 |
-
|
814 |
-
- `Predis\Client::create()` has been removed. Just use the constructor to set
|
815 |
-
up a new instance of `Predis\Client`.
|
816 |
-
|
817 |
-
- `Predis\Client::pipelineSafe()` was deprecated in Predis v0.6.1 and now has
|
818 |
-
finally removed. Use `Predis\Client::pipeline(array('safe' => true))`.
|
819 |
-
|
820 |
-
- `Predis\Client::rawCommand()` has been removed due to inconsistencies with
|
821 |
-
the underlying connection abstractions. You can still get the raw resource
|
822 |
-
out of a connection with `Predis\Network\IConnectionSingle::getResource()`
|
823 |
-
so that you can talk directly with Redis.
|
824 |
-
|
825 |
-
- The `Predis\MultiBulkCommand` class has been merged into `Predis\Command` and
|
826 |
-
thus removed. Serialization of commands is now a competence of connections.
|
827 |
-
|
828 |
-
- The `Predis\IConnection` interface has been splitted into two new interfaces:
|
829 |
-
`Predis\Network\IConnectionSingle` and `Predis\Network\IConnectionCluster`.
|
830 |
-
|
831 |
-
- The constructor of `Predis\Client` now accepts more type of arguments such as
|
832 |
-
instances of `Predis\IConnectionParameters` and `Predis\Network\IConnection`.
|
833 |
-
|
834 |
-
|
835 |
-
v0.6.6 (2011-04-01)
|
836 |
-
================================================================================
|
837 |
-
|
838 |
-
- Switched to Redis 2.2 as the default server profile (there are no changes
|
839 |
-
that would break compatibility with previous releases). Long command names
|
840 |
-
are no more supported by default but if you need them you can still require
|
841 |
-
`Predis_Compatibility.php` to avoid breaking compatibility.
|
842 |
-
|
843 |
-
- Added a `VERSION` constant to `Predis\Client`.
|
844 |
-
|
845 |
-
- Some performance improvements for multibulk replies (parsing them is about
|
846 |
-
16% faster than the previous version). A few core classes have been heavily
|
847 |
-
optimized to reduce overhead when creating new instances.
|
848 |
-
|
849 |
-
- Predis now uses by default a new protocol reader, more lightweight and
|
850 |
-
faster than the default handler-based one. Users can revert to the old
|
851 |
-
protocol reader with the `reader` client option set to `composable`.
|
852 |
-
This client option can also accept custom reader classes implementing the
|
853 |
-
new `Predis\IResponseReader` interface.
|
854 |
-
|
855 |
-
- Added support for connecting to Redis using UNIX domain sockets (ISSUE #25).
|
856 |
-
|
857 |
-
- The `read_write_timeout` connection parameter can now be set to 0 or false
|
858 |
-
to disable read and write timeouts on connections. The old behaviour of -1
|
859 |
-
is still intact.
|
860 |
-
|
861 |
-
- `ZUNIONSTORE` and `ZINTERSTORE` can accept an array to specify a list of the
|
862 |
-
source keys to be used to populate the destination key.
|
863 |
-
|
864 |
-
- `MGET`, `SINTER`, `SUNION` and `SDIFF` can accept an array to specify a list
|
865 |
-
of keys. `SINTERSTORE`, `SUNIONSTORE` and `SDIFFSTORE` can also accept an
|
866 |
-
array to specify the list of source keys.
|
867 |
-
|
868 |
-
- `SUBSCRIBE` and `PSUBSCRIBE` can accept a list of channels for subscription.
|
869 |
-
|
870 |
-
- __FIX__: some client-side clean-ups for `MULTI/EXEC` were handled incorrectly
|
871 |
-
in a couple of corner cases (ISSUE #27).
|
872 |
-
|
873 |
-
|
874 |
-
v0.6.5 (2011-02-12)
|
875 |
-
================================================================================
|
876 |
-
|
877 |
-
- __FIX__: due to an untested internal change introduced in v0.6.4, a wrong
|
878 |
-
handling of bulk reads of zero-length values was producing protocol
|
879 |
-
desynchronization errors (ISSUE #20).
|
880 |
-
|
881 |
-
|
882 |
-
v0.6.4 (2011-02-12)
|
883 |
-
================================================================================
|
884 |
-
|
885 |
-
- Various performance improvements (15% ~ 25%) especially when dealing with
|
886 |
-
long multibulk replies or when using clustered connections.
|
887 |
-
|
888 |
-
- Added the `on_retry` option to `Predis\MultiExecBlock` that can be used to
|
889 |
-
specify an external callback (or any callable object) that gets invoked
|
890 |
-
whenever a transaction is aborted by the server.
|
891 |
-
|
892 |
-
- Added inline (p)subscribtion via options when initializing an instance of
|
893 |
-
`Predis\PubSubContext`.
|
894 |
-
|
895 |
-
|
896 |
-
v0.6.3 (2011-01-01)
|
897 |
-
================================================================================
|
898 |
-
|
899 |
-
- New commands available in the Redis v2.2 profile (dev):
|
900 |
-
- Strings: `SETRANGE`, `GETRANGE`, `SETBIT`, `GETBIT`
|
901 |
-
- Lists : `BRPOPLPUSH`
|
902 |
-
|
903 |
-
- The abstraction for `MULTI/EXEC` transactions has been dramatically improved
|
904 |
-
by providing support for check-and-set (CAS) operations when using Redis >=
|
905 |
-
2.2. Aborted transactions can also be optionally replayed in automatic up
|
906 |
-
to a user-defined number of times, after which a `Predis\AbortedMultiExec`
|
907 |
-
exception is thrown.
|
908 |
-
|
909 |
-
|
910 |
-
v0.6.2 (2010-11-28)
|
911 |
-
================================================================================
|
912 |
-
|
913 |
-
- Minor internal improvements and clean ups.
|
914 |
-
|
915 |
-
- New commands available in the Redis v2.2 profile (dev):
|
916 |
-
- Strings: `STRLEN`
|
917 |
-
- Lists : `LINSERT`, `RPUSHX`, `LPUSHX`
|
918 |
-
- ZSets : `ZREVRANGEBYSCORE`
|
919 |
-
- Misc. : `PERSIST`
|
920 |
-
|
921 |
-
- WATCH also accepts a single array parameter with the keys that should be
|
922 |
-
monitored during a transaction.
|
923 |
-
|
924 |
-
- Improved the behaviour of `Predis\MultiExecBlock` in certain corner cases.
|
925 |
-
|
926 |
-
- Improved parameters checking for the SORT command.
|
927 |
-
|
928 |
-
- __FIX__: the `STORE` parameter for the `SORT` command didn't work correctly
|
929 |
-
when using `0` as the target key (ISSUE #13).
|
930 |
-
|
931 |
-
- __FIX__: the methods for `UNWATCH` and `DISCARD` do not break anymore method
|
932 |
-
chaining with `Predis\MultiExecBlock`.
|
933 |
-
|
934 |
-
|
935 |
-
v0.6.1 (2010-07-11)
|
936 |
-
================================================================================
|
937 |
-
|
938 |
-
- Minor internal improvements and clean ups.
|
939 |
-
|
940 |
-
- New commands available in the Redis v2.2 profile (dev):
|
941 |
-
- Misc. : `WATCH`, `UNWATCH`
|
942 |
-
|
943 |
-
- Optional modifiers for `ZRANGE`, `ZREVRANGE` and `ZRANGEBYSCORE` queries are
|
944 |
-
supported using an associative array passed as the last argument of their
|
945 |
-
respective methods.
|
946 |
-
|
947 |
-
- The `LIMIT` modifier for `ZRANGEBYSCORE` can be specified using either:
|
948 |
-
- an indexed array: `array($offset, $count)`
|
949 |
-
- an associative array: `array('offset' => $offset, 'count' => $count)`
|
950 |
-
|
951 |
-
- The method `Predis\Client::__construct()` now accepts also instances of
|
952 |
-
`Predis\ConnectionParameters`.
|
953 |
-
|
954 |
-
- `Predis\MultiExecBlock` and `Predis\PubSubContext` now throw an exception
|
955 |
-
when trying to create their instances using a profile that does not
|
956 |
-
support the required Redis commands or when the client is connected to
|
957 |
-
a cluster of connections.
|
958 |
-
|
959 |
-
- Various improvements to `Predis\MultiExecBlock`:
|
960 |
-
- fixes and more consistent behaviour across various usage cases.
|
961 |
-
- support for `WATCH` and `UNWATCH` when using the current development
|
962 |
-
profile (Redis v2.2) and aborted transactions.
|
963 |
-
|
964 |
-
- New signature for `Predis\Client::multiExec()` which is now able to accept
|
965 |
-
an array of options for the underlying instance of `Predis\MultiExecBlock`.
|
966 |
-
Backwards compatibility with previous releases of Predis is ensured.
|
967 |
-
|
968 |
-
- New signature for `Predis\Client::pipeline()` which is now able to accept
|
969 |
-
an array of options for the underlying instance of Predis\CommandPipeline.
|
970 |
-
Backwards compatibility with previous releases of Predis is ensured.
|
971 |
-
The method `Predis\Client::pipelineSafe()` is to be considered deprecated.
|
972 |
-
|
973 |
-
- __FIX__: The `WEIGHT` modifier for `ZUNIONSTORE` and `ZINTERSTORE` was
|
974 |
-
handled incorrectly with more than two weights specified.
|
975 |
-
|
976 |
-
|
977 |
-
v0.6.0 (2010-05-24)
|
978 |
-
================================================================================
|
979 |
-
|
980 |
-
- Switched to the new multi-bulk request protocol for all of the commands
|
981 |
-
in the Redis 1.2 and Redis 2.0 profiles. Inline and bulk requests are now
|
982 |
-
deprecated as they will be removed in future releases of Redis.
|
983 |
-
|
984 |
-
- The default server profile is `2.0` (targeting Redis 2.0.x). If you are
|
985 |
-
using older versions of Redis, it is highly recommended that you specify
|
986 |
-
which server profile the client should use (e.g. `1.2` when connecting
|
987 |
-
to instances of Redis 1.2.x).
|
988 |
-
|
989 |
-
- Support for Redis 1.0 is now optional and it is provided by requiring
|
990 |
-
'Predis_Compatibility.php' before creating an instance of `Predis\Client`.
|
991 |
-
|
992 |
-
- New commands added to the Redis 2.0 profile since Predis 0.5.1:
|
993 |
-
- Strings: `SETEX`, `APPEND`, `SUBSTR`
|
994 |
-
- ZSets : `ZCOUNT`, `ZRANK`, `ZUNIONSTORE`, `ZINTERSTORE`, `ZREMBYRANK`,
|
995 |
-
`ZREVRANK`
|
996 |
-
- Hashes : `HSET`, `HSETNX`, `HMSET`, `HINCRBY`, `HGET`, `HMGET`, `HDEL`,
|
997 |
-
`HEXISTS`, `HLEN`, `HKEYS`, `HVALS`, `HGETALL`
|
998 |
-
- PubSub : `PUBLISH`, `SUBSCRIBE`, `UNSUBSCRIBE`
|
999 |
-
- Misc. : `DISCARD`, `CONFIG`
|
1000 |
-
|
1001 |
-
- Introduced client-level options with the new `Predis\ClientOptions` class.
|
1002 |
-
Options can be passed to the constructor of `Predis\Client` in its second
|
1003 |
-
argument as an array or an instance of `Predis\ClientOptions`. For brevity's
|
1004 |
-
sake and compatibility with older versions, the constructor still accepts
|
1005 |
-
an instance of `Predis\RedisServerProfile` in its second argument. The
|
1006 |
-
currently supported client options are:
|
1007 |
-
|
1008 |
-
- `profile` [default: `2.0` as of Predis 0.6.0]: specifies which server
|
1009 |
-
profile to use when connecting to Redis. This option accepts an instance
|
1010 |
-
of `Predis\RedisServerProfile` or a string that indicates the version.
|
1011 |
-
|
1012 |
-
- `key_distribution` [default: `Predis\Distribution\HashRing`]: specifies
|
1013 |
-
which key distribution strategy to use to distribute keys among the
|
1014 |
-
servers that compose a cluster. This option accepts an instance of
|
1015 |
-
`Predis\Distribution\IDistributionStrategy` so that users can implement
|
1016 |
-
their own key distribution strategy. `Predis\Distribution\KetamaPureRing`
|
1017 |
-
is an alternative distribution strategy providing a pure-PHP implementation
|
1018 |
-
of the same algorithm used by libketama.
|
1019 |
-
|
1020 |
-
- `throw_on_error` [default: `TRUE`]: server errors can optionally be handled
|
1021 |
-
"silently": instead of throwing an exception, the client returns an error
|
1022 |
-
response type.
|
1023 |
-
|
1024 |
-
- `iterable_multibulk` [EXPERIMENTAL - default: `FALSE`]: in addition to the
|
1025 |
-
classic way of fetching a whole multibulk reply into an array, the client
|
1026 |
-
can now optionally stream a multibulk reply down to the user code by using
|
1027 |
-
PHP iterators. It is just a little bit slower, but it can save a lot of
|
1028 |
-
memory in certain scenarios.
|
1029 |
-
|
1030 |
-
- New parameters for connections:
|
1031 |
-
|
1032 |
-
- `alias` [default: not set]: every connection can now be identified by an
|
1033 |
-
alias that is useful to get a specific connections when connected to a
|
1034 |
-
cluster of Redis servers.
|
1035 |
-
- `weight` [default: not set]: allows to balance keys asymmetrically across
|
1036 |
-
multiple servers. This is useful when you have servers with different
|
1037 |
-
amounts of memory to distribute the load of your keys accordingly.
|
1038 |
-
- `connection_async` [default: `FALSE`]: estabilish connections to servers
|
1039 |
-
in a non-blocking way, so that the client is not blocked while the socket
|
1040 |
-
resource performs the actual connection.
|
1041 |
-
- `connection_persistent` [default: `FALSE`]: the underlying socket resource
|
1042 |
-
is left open when a script ends its lifecycle. Persistent connections can
|
1043 |
-
lead to unpredictable or strange behaviours, so they should be used with
|
1044 |
-
extreme care.
|
1045 |
-
|
1046 |
-
- Introduced the `Predis\Pipeline\IPipelineExecutor` interface. Classes that
|
1047 |
-
implements this interface are used internally by the `Predis\CommandPipeline`
|
1048 |
-
class to change the behaviour of the pipeline when writing/reading commands
|
1049 |
-
from one or multiple servers. Here is the list of the default executors:
|
1050 |
-
|
1051 |
-
- `Predis\Pipeline\StandardExecutor`: exceptions generated by server errors
|
1052 |
-
might be thrown depending on the options passed to the client (see the
|
1053 |
-
`throw_on_error` client option). Instead, protocol or network errors always
|
1054 |
-
throw exceptions. This is the default executor for single and clustered
|
1055 |
-
connections and shares the same behaviour of Predis 0.5.x.
|
1056 |
-
- `Predis\Pipeline\SafeExecutor`: exceptions generated by server, protocol
|
1057 |
-
or network errors are not thrown but returned in the response array as
|
1058 |
-
instances of `Predis\ResponseError` or `Predis\CommunicationException`.
|
1059 |
-
- `Predis\Pipeline\SafeClusterExecutor`: this executor shares the same
|
1060 |
-
behaviour of `Predis\Pipeline\SafeExecutor` but it is geared towards
|
1061 |
-
clustered connections.
|
1062 |
-
|
1063 |
-
- Support for PUB/SUB is handled by the new `Predis\PubSubContext` class, which
|
1064 |
-
could also be used to build a callback dispatcher for PUB/SUB scenarios.
|
1065 |
-
|
1066 |
-
- When connected to a cluster of connections, it is now possible to get a
|
1067 |
-
new `Predis\Client` instance for a single connection of the cluster by
|
1068 |
-
passing its alias/index to the new `Predis\Client::getClientFor()` method.
|
1069 |
-
|
1070 |
-
- `Predis\CommandPipeline` and `Predis\MultiExecBlock` return their instances
|
1071 |
-
when invokink commands, thus allowing method chaining in pipelines and
|
1072 |
-
multi-exec blocks.
|
1073 |
-
|
1074 |
-
- `Predis\MultiExecBlock` can handle the new `DISCARD` command.
|
1075 |
-
|
1076 |
-
- Connections now support float values for the `connection_timeout` parameter
|
1077 |
-
to express timeouts with a microsecond resolution.
|
1078 |
-
|
1079 |
-
- __FIX__: TCP connections now respect the read/write timeout parameter when
|
1080 |
-
reading the payload of server responses. Previously, `stream_get_contents()`
|
1081 |
-
was being used internally to read data from a connection but it looks like
|
1082 |
-
PHP does not honour the specified timeout for socket streams when inside
|
1083 |
-
this function.
|
1084 |
-
|
1085 |
-
- __FIX__: The `GET` parameter for the `SORT` command now accepts also multiple
|
1086 |
-
key patterns by passing an array of strings. (ISSUE #1).
|
1087 |
-
|
1088 |
-
* __FIX__: Replies to the `DEL` command return the number of elements deleted
|
1089 |
-
by the server and not 0 or 1 interpreted as a boolean response. (ISSUE #4).
|
1090 |
-
|
1091 |
-
|
1092 |
-
v0.5.1 (2010-01-23)
|
1093 |
-
================================================================================
|
1094 |
-
|
1095 |
-
* `RPOPLPUSH` has been changed from bulk command to inline command in Redis
|
1096 |
-
1.2.1, so `ListPopLastPushHead` now extends `InlineCommand`. The old behavior
|
1097 |
-
is still available via the `ListPopLastPushHeadBulk` class so that you can
|
1098 |
-
override the server profile if you need the old (and uncorrect) behaviour
|
1099 |
-
when connecting to a Redis 1.2.0 instance.
|
1100 |
-
|
1101 |
-
* Added missing support for `BGREWRITEAOF` for Redis >= 1.2.0.
|
1102 |
-
|
1103 |
-
* Implemented a factory method for the `RedisServerProfile` class to ease the
|
1104 |
-
creation of new server profile instances based on a version string.
|
1105 |
-
|
1106 |
-
|
1107 |
-
v0.5.0 (2010-01-09)
|
1108 |
-
================================================================================
|
1109 |
-
* First versioned release of Predis
|
1 |
+
## Changelog
|
2 |
+
|
3 |
+
## v2.0.0 (2022-06-08)
|
4 |
+
|
5 |
+
- Dropped support for PHP 7.1 and older
|
6 |
+
|
7 |
+
- Accepted values for some client options have changed, this is the new list of
|
8 |
+
accepted values:
|
9 |
+
|
10 |
+
- `aggregate`: callable returning an aggregate connection.
|
11 |
+
- `cluster`: string value (`predis`, `redis`), callable returning an aggregate
|
12 |
+
connection.
|
13 |
+
- `replication`: string value (`predis`, `sentinel`), callable returning an
|
14 |
+
aggregate connection.
|
15 |
+
- `commands`: command factory, named array mapping command IDs to PHP classes,
|
16 |
+
callable returning a command factory or a named array.
|
17 |
+
- `connections`: connection factory, callable object returning a connection
|
18 |
+
factory, named array mapping URI schemes to PHP classes, string identifying
|
19 |
+
a supported combination of configurations for the connection factory.
|
20 |
+
- `prefix`: string value, command processor, callable.
|
21 |
+
- `exceptions`: boolean.
|
22 |
+
|
23 |
+
Note that both the `cluster` and `replication` options now return a closure
|
24 |
+
acting as initializer instead of an aggregate connection instance.
|
25 |
+
|
26 |
+
- The `connections` client option now accepts certain string values identifying
|
27 |
+
certain combinations of configurations for the connection factory. Currenlty
|
28 |
+
this is used to provide a short way to configure Predis to load our phpiredis
|
29 |
+
based connection backends simply, accepted values are:
|
30 |
+
|
31 |
+
- `phpiredis-stream` maps `Phpiredis\Connection\PhpiredisStreamConnection` to
|
32 |
+
`tcp`, `redis`, `unix` URI schemes.
|
33 |
+
- `phpiredis-socket` maps `Phpiredis\Connection\PhpiredisSocketConnection` to
|
34 |
+
`tcp`, `redis`, `unix` URI schemes.
|
35 |
+
- `phpiredis-stream` is simply an alias of `phpiredis-stream`.
|
36 |
+
|
37 |
+
- Added the new `Predis\Cluster\Hash\PhpiredisCRC16` class using ext-phpiredis
|
38 |
+
to speed-up the generation of the CRC16 hash of keys for redis-cluster. Predis
|
39 |
+
automatically uses this class when ext-phpiredis is loaded, but it is possible
|
40 |
+
to configure the hash generator using the new `crc16` client option (accepted
|
41 |
+
values `predis`, `phpiredis` or an hash generator instance).
|
42 |
+
|
43 |
+
- Replication backends now use the `role` parameter instead of `alias` in order
|
44 |
+
to distinguish the role of a connection. Accepted values are `master`, `slave`
|
45 |
+
and, for redis-sentinel, `sentinel`. This led to a redesign of how connections
|
46 |
+
can be retrieved from replication backends: the method getConnectionById() now
|
47 |
+
retrieves a connection only by its ID (ip:port pair), to get a connection by
|
48 |
+
its alias there is the new method getConnectionByAlias(). This method is not
|
49 |
+
supported by the redis-sentinel backend due to its dynamic nature (connections
|
50 |
+
are retrieved and initialized at runtime from sentinels) but it is possible to
|
51 |
+
get a single connection from the pool by using its ID. It is also possible to
|
52 |
+
retrive a connection by role using the method getConnectionByRole().
|
53 |
+
|
54 |
+
- The concept of connection ID (ip:port pair) and connection alias (the `alias`
|
55 |
+
parameter) in `Predis\Connection\Cluster\PredisCluster` has been separated.
|
56 |
+
This change does not affect distribution and it is safe for existing clusters.
|
57 |
+
|
58 |
+
- Client option classes now live in the `Predis\Configuration\Option` namespace.
|
59 |
+
|
60 |
+
- Classes for Redis commands have been moved into the new `Predis\Command\Redis`
|
61 |
+
namespace and each class name mirrors the respective Redis command ID.
|
62 |
+
|
63 |
+
- The concept of server profiles is gone, the library now uses a single command
|
64 |
+
factory to create instances of commands classes. The `profile` option has been
|
65 |
+
replaced by the `commands` option accepting `Predis\Command\FactoryInterface`
|
66 |
+
to customize the underlying command factory. The default command factory class
|
67 |
+
used by Predis is `Predis\Command\RedisFactory` and it still allows developers
|
68 |
+
to define or override commands with their own implementations. In addition to
|
69 |
+
that, `Predis\Command\RedisFactory` relies on a convention-over-configuration
|
70 |
+
approach by looking for a suitable class with the same name as the command ID
|
71 |
+
in the `Predis\Command\Redis` when the internal class map does not contain a
|
72 |
+
class associated.
|
73 |
+
|
74 |
+
- The method `Predis\Client::getClientFor($connectionID)` has been replaced by
|
75 |
+
`getClientBy($selector, $value, $callable = null)` which is more flexible as
|
76 |
+
it is not limited to picking a connection from the underlying replication or
|
77 |
+
cluster backend by ID, but allows users to specify a `$selector` that can be
|
78 |
+
either `id` (the old behavior), `key`, `slot` or `command`. The client uses
|
79 |
+
duck-typing instead of type-checking to verify that the underlying connection
|
80 |
+
implements a method that matches the specified selector which means that some
|
81 |
+
selectors may not be available to all kinds of connection backends.
|
82 |
+
|
83 |
+
- The method `Predis\Client::getConnectionById($connectionID)` has been removed.
|
84 |
+
|
85 |
+
- Changed the signature for the constructor of `Predis\Command\RawCommand`.
|
86 |
+
|
87 |
+
- The `Predis\Connection\Aggregate` namespace has been split into two separate
|
88 |
+
namespaces for cluster backends (`Predis\Connection\Cluster`) and replication
|
89 |
+
backends (`Predis\Connection\Replication`).
|
90 |
+
|
91 |
+
- The method `Predis\Connection\AggregateConnectionInterface::getConnection()`
|
92 |
+
has been renamed to `getConnectionByCommand()`.
|
93 |
+
|
94 |
+
- The methods `switchToMaster()` and `switchToSlave()` have been promoted to be
|
95 |
+
part of `Predis\Connection\Replication\ReplicationInterface` while the method
|
96 |
+
`switchTo($connection)` has been removed from it.
|
97 |
+
|
98 |
+
- The method `Predis\Connection\Cluster\PredisCluster::executeCommandOnNodes()`
|
99 |
+
has been removed as it is possible to achieve the same by iterating over the
|
100 |
+
connection or, even better, over the client instance in order to execute the
|
101 |
+
same command against all of the registered connections.
|
102 |
+
|
103 |
+
- The class `Predis\CommunicationException` now uses the correct default types
|
104 |
+
for the `$message` (string) and `$code` (integer) parameters.
|
105 |
+
|
106 |
+
- The method `onConnectionError()` in `Predis\Connection\AbstractConnection`
|
107 |
+
class now passes the second argument as an integer value `0` as its default
|
108 |
+
value instead of `null`.
|
109 |
+
|
110 |
+
- Support Pub/Sub and Pipelines when using replication
|
111 |
+
|
112 |
+
- The class `Predis\Transaction\AbortedMultiExecException` now uses the correct
|
113 |
+
default types for the `$code` (integer) parameter.
|
114 |
+
|
115 |
+
- __FIX__: using `strval` in `getScanOptions()` method, part of
|
116 |
+
`Predis\Collection\Iterator\CursorBasedIterator` to make sure we retrieve the
|
117 |
+
string value of `$this->match` and not passing `null` to `strlen()` function.
|
118 |
+
|
119 |
+
- __FIX__: the value returned from `getArgument()` in `isReadOperation()` method,
|
120 |
+
part of `Predis\Replication\ReplicationStrategy` class, is checked to not pass
|
121 |
+
`null` to `sha1` function.
|
122 |
+
|
123 |
+
- __FIX__: the value returned from `getArgument()` in `parseResponse()`method,
|
124 |
+
part of `Predis\Command\Redis\SENTINEL` class, is checked to not pass `null`
|
125 |
+
to `strtolower()` function.
|
126 |
+
|
127 |
+
## v2.0.0-beta.1 (2022-05-26)
|
128 |
+
|
129 |
+
Same as v2.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright (c) 2009-
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person
|
4 |
obtaining a copy of this software and associated documentation
|
1 |
+
Copyright (c) 2009-2021 Daniele Alessandri
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person
|
4 |
obtaining a copy of this software and associated documentation
|
dependencies/predis/predis/README.md
CHANGED
@@ -4,20 +4,16 @@
|
|
4 |
[![Latest stable][ico-version-stable]][link-packagist]
|
5 |
[![Latest development][ico-version-dev]][link-packagist]
|
6 |
[![Monthly installs][ico-downloads-monthly]][link-downloads]
|
7 |
-
[![Build status][ico-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
Predis does not require any additional C extension by default, but it can be optionally paired with
|
12 |
-
[phpiredis](https://github.com/nrk/phpiredis) to lower the overhead of the serialization and parsing
|
13 |
-
of the [Redis RESP Protocol](http://redis.io/topics/protocol).
|
14 |
|
15 |
More details about this project can be found on the [frequently asked questions](FAQ.md).
|
16 |
|
17 |
|
18 |
## Main features ##
|
19 |
|
20 |
-
- Support for
|
21 |
- Support for clustering using client-side sharding and pluggable keyspace distributors.
|
22 |
- Support for [redis-cluster](http://redis.io/topics/cluster-tutorial) (Redis >= 3.0).
|
23 |
- Support for master-slave replication setups and [redis-sentinel](http://redis.io/topics/sentinel).
|
@@ -30,15 +26,14 @@ More details about this project can be found on the [frequently asked questions]
|
|
30 |
- Connections can be established via TCP/IP (also TLS/SSL-encrypted) or UNIX domain sockets.
|
31 |
- Support for [Webdis](http://webd.is) (requires both `ext-curl` and `ext-phpiredis`).
|
32 |
- Support for custom connection classes for providing different network or protocol backends.
|
33 |
-
- Flexible system for defining custom commands and
|
34 |
|
35 |
|
36 |
## How to _install_ and use Predis ##
|
37 |
|
38 |
This library can be found on [Packagist](http://packagist.org/packages/predis/predis) for an easier
|
39 |
-
management of projects dependencies using [Composer](http://packagist.org/about-composer)
|
40 |
-
|
41 |
-
compressed archives of each release are [available on GitHub](https://github.com/predis/predis/releases).
|
42 |
|
43 |
|
44 |
### Loading the library ###
|
@@ -55,10 +50,6 @@ require 'Predis/Autoloader.php';
|
|
55 |
Predis\Autoloader::register();
|
56 |
```
|
57 |
|
58 |
-
It is also possible to create a [phar](http://www.php.net/manual/en/intro.phar.php) archive directly
|
59 |
-
from the repository by launching the `bin/create-phar` script. The generated phar already contains a
|
60 |
-
stub defining its own autoloader, so you just need to `require()` it to start using the library.
|
61 |
-
|
62 |
|
63 |
### Connecting to Redis ###
|
64 |
|
@@ -122,14 +113,16 @@ the rules described on their respective IANA provisional registration documents.
|
|
122 |
The actual list of supported connection parameters can vary depending on each connection backend so
|
123 |
it is recommended to refer to their specific documentation or implementation for details.
|
124 |
|
125 |
-
|
126 |
-
|
|
|
127 |
for each node:
|
128 |
|
129 |
```php
|
130 |
$client = new Predis\Client([
|
131 |
-
'tcp://10.0.0.1?alias=first-node',
|
132 |
-
|
|
|
133 |
]);
|
134 |
```
|
135 |
|
@@ -148,20 +141,20 @@ Many aspects and behaviors of the client can be configured by passing specific c
|
|
148 |
second argument of `Predis\Client::__construct()`:
|
149 |
|
150 |
```php
|
151 |
-
$client = new Predis\Client($parameters, ['
|
152 |
```
|
153 |
|
154 |
Options are managed using a mini DI-alike container and their values can be lazily initialized only
|
155 |
when needed. The client options supported by default in Predis are:
|
156 |
|
157 |
-
- `
|
158 |
-
- `prefix`: prefix string automatically applied to keys found in commands.
|
159 |
- `exceptions`: whether the client should throw or return responses upon Redis errors.
|
160 |
- `connections`: list of connection backends or a connection factory instance.
|
161 |
-
- `cluster`: specifies a cluster backend (`predis`, `redis` or callable
|
162 |
-
- `replication`: specifies a replication backend (`
|
163 |
-
- `aggregate`:
|
164 |
- `parameters`: list of default connection parameters for aggregate connections.
|
|
|
165 |
|
166 |
Users can also provide custom options with values or callable objects (for lazy initialization) that
|
167 |
are stored in the options container for later use through the library.
|
@@ -172,18 +165,18 @@ are stored in the options container for later use through the library.
|
|
172 |
Aggregate connections are the foundation upon which Predis implements clustering and replication and
|
173 |
they are used to group multiple connections to single Redis nodes and hide the specific logic needed
|
174 |
to handle them properly depending on the context. Aggregate connections usually require an array of
|
175 |
-
connection parameters when creating a new client instance.
|
176 |
|
177 |
#### Cluster ####
|
178 |
|
179 |
-
|
180 |
-
to
|
181 |
-
|
182 |
-
|
183 |
-
operations to rebalance the keyspace when changing its configuration by adding or removing nodes:
|
184 |
|
185 |
```php
|
186 |
$parameters = ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'];
|
|
|
187 |
|
188 |
$client = new Predis\Client($parameters);
|
189 |
```
|
@@ -213,12 +206,12 @@ the value of a key. Instead of raising a connection error when a slave fails, th
|
|
213 |
fall back to a different slave among the ones provided in the configuration.
|
214 |
|
215 |
The basic configuration needed to use the client in replication mode requires one Redis server to be
|
216 |
-
identified as the master (this can be done via connection parameters
|
217 |
-
to `master`) and one or more
|
218 |
|
219 |
```php
|
220 |
-
$parameters = ['tcp://10.0.0.1?
|
221 |
-
$options = ['replication' =>
|
222 |
|
223 |
$client = new Predis\Client($parameters, $options);
|
224 |
```
|
@@ -259,13 +252,13 @@ when certain Lua scripts do not perform write operations it is possible to provi
|
|
259 |
the client to stick with slaves for their execution:
|
260 |
|
261 |
```php
|
262 |
-
$parameters = ['tcp://10.0.0.1?
|
263 |
$options = ['replication' => function () {
|
264 |
// Set scripts that won't trigger a switch from a slave to the master node.
|
265 |
$strategy = new Predis\Replication\ReplicationStrategy();
|
266 |
$strategy->setScriptReadOnly($LUA_SCRIPT);
|
267 |
|
268 |
-
return new Predis\Connection\
|
269 |
}];
|
270 |
|
271 |
$client = new Predis\Client($parameters, $options);
|
@@ -324,7 +317,7 @@ of a transaction using CAS you can see [the following example](examples/transact
|
|
324 |
While we try to update Predis to stay up to date with all the commands available in Redis, you might
|
325 |
prefer to stick with an old version of the library or provide a different way to filter arguments or
|
326 |
parse responses for specific commands. To achieve that, Predis provides the ability to implement new
|
327 |
-
command classes to define or override commands in the default
|
328 |
|
329 |
```php
|
330 |
// Define a new command by extending Predis\Command\Command:
|
@@ -336,9 +329,12 @@ class BrandNewRedisCommand extends Predis\Command\Command
|
|
336 |
}
|
337 |
}
|
338 |
|
339 |
-
// Inject your command in the current
|
340 |
-
$client = new Predis\Client(
|
341 |
-
|
|
|
|
|
|
|
342 |
|
343 |
$response = $client->newcmd();
|
344 |
```
|
@@ -357,7 +353,7 @@ $response = $client->executeRaw(['SET', 'foo', 'bar']);
|
|
357 |
While it is possible to leverage [Lua scripting](http://redis.io/commands/eval) on Redis 2.6+ using
|
358 |
directly [`EVAL`](http://redis.io/commands/eval) and [`EVALSHA`](http://redis.io/commands/evalsha),
|
359 |
Predis offers script commands as an higher level abstraction built upon them to make things simple.
|
360 |
-
Script commands can be registered in the
|
361 |
they were plain Redis commands, but they define Lua scripts that get transmitted to the server for
|
362 |
remote execution. Internally they use [`EVALSHA`](http://redis.io/commands/evalsha) by default and
|
363 |
identify a script by its SHA1 hash to save bandwidth, but [`EVAL`](http://redis.io/commands/eval)
|
@@ -383,9 +379,12 @@ LUA;
|
|
383 |
}
|
384 |
}
|
385 |
|
386 |
-
// Inject the script command in the current
|
387 |
-
$client = new Predis\Client(
|
388 |
-
|
|
|
|
|
|
|
389 |
|
390 |
$response = $client->lpushrand('random_values', $seed = mt_rand());
|
391 |
```
|
@@ -407,6 +406,17 @@ $client = new Predis\Client('tcp://127.0.0.1', [
|
|
407 |
]);
|
408 |
```
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
Developers can create their own connection classes to support whole new network backends, extend
|
411 |
existing classes or provide completely different implementations. Connection classes must implement
|
412 |
`Predis\Connection\NodeConnectionInterface` or extend `Predis\Connection\AbstractConnection`:
|
@@ -443,18 +453,14 @@ stay consistent while working on the project.
|
|
443 |
__ATTENTION__: Do not ever run the test suite shipped with Predis against instances of Redis running
|
444 |
in production environments or containing data you are interested in!
|
445 |
|
446 |
-
Predis has a comprehensive test suite covering every aspect of the library
|
447 |
-
integration tests against a running instance of Redis (>= 2.4.0
|
448 |
-
behavior of the implementation of each command
|
449 |
-
|
450 |
-
|
451 |
-
(which is the current stable version of Redis) but can optionally target a Redis instance built from
|
452 |
-
the `unstable` branch by modifying `phpunit.xml` and setting `REDIS_SERVER_VERSION` to `dev` so that
|
453 |
-
the development server profile will be used. You can refer to [the tests README](tests/README.md)
|
454 |
-
for more detailed information about testing Predis.
|
455 |
|
456 |
-
Predis uses
|
457 |
-
found [on its
|
458 |
|
459 |
|
460 |
## Other ##
|
@@ -465,12 +471,12 @@ found [on its project page](http://travis-ci.org/predis/predis).
|
|
465 |
- [Source code](https://github.com/predis/predis)
|
466 |
- [Wiki](https://github.com/predis/predis/wiki)
|
467 |
- [Issue tracker](https://github.com/predis/predis/issues)
|
468 |
-
- [PEAR channel](http://pear.nrk.io)
|
469 |
|
470 |
|
471 |
### Author ###
|
472 |
|
473 |
- [Daniele Alessandri](mailto:suppakilla@gmail.com) ([twitter](http://twitter.com/JoL1hAHN))
|
|
|
474 |
|
475 |
|
476 |
### License ###
|
@@ -481,9 +487,8 @@ The code for Predis is distributed under the terms of the MIT license (see [LICE
|
|
481 |
[ico-version-stable]: https://img.shields.io/packagist/v/predis/predis.svg?style=flat-square
|
482 |
[ico-version-dev]: https://img.shields.io/packagist/vpre/predis/predis.svg?style=flat-square
|
483 |
[ico-downloads-monthly]: https://img.shields.io/packagist/dm/predis/predis.svg?style=flat-square
|
484 |
-
[ico-
|
485 |
-
[ico-hhvm]: https://img.shields.io/hhvm/predis/predis.svg?style=flat-square
|
486 |
|
487 |
[link-packagist]: https://packagist.org/packages/predis/predis
|
488 |
-
[link-
|
489 |
[link-downloads]: https://packagist.org/packages/predis/predis/stats
|
4 |
[![Latest stable][ico-version-stable]][link-packagist]
|
5 |
[![Latest development][ico-version-dev]][link-packagist]
|
6 |
[![Monthly installs][ico-downloads-monthly]][link-downloads]
|
7 |
+
[![Build status][ico-build]][link-actions]
|
8 |
|
9 |
+
A flexible and feature-complete [Redis](http://redis.io) client for PHP 7.2 and newer.
|
|
|
|
|
|
|
|
|
10 |
|
11 |
More details about this project can be found on the [frequently asked questions](FAQ.md).
|
12 |
|
13 |
|
14 |
## Main features ##
|
15 |
|
16 |
+
- Support for Redis from __3.0__ to __7.0__.
|
17 |
- Support for clustering using client-side sharding and pluggable keyspace distributors.
|
18 |
- Support for [redis-cluster](http://redis.io/topics/cluster-tutorial) (Redis >= 3.0).
|
19 |
- Support for master-slave replication setups and [redis-sentinel](http://redis.io/topics/sentinel).
|
26 |
- Connections can be established via TCP/IP (also TLS/SSL-encrypted) or UNIX domain sockets.
|
27 |
- Support for [Webdis](http://webd.is) (requires both `ext-curl` and `ext-phpiredis`).
|
28 |
- Support for custom connection classes for providing different network or protocol backends.
|
29 |
+
- Flexible system for defining custom commands and override the default ones.
|
30 |
|
31 |
|
32 |
## How to _install_ and use Predis ##
|
33 |
|
34 |
This library can be found on [Packagist](http://packagist.org/packages/predis/predis) for an easier
|
35 |
+
management of projects dependencies using [Composer](http://packagist.org/about-composer).
|
36 |
+
Compressed archives of each release are [available on GitHub](https://github.com/predis/predis/releases).
|
|
|
37 |
|
38 |
|
39 |
### Loading the library ###
|
50 |
Predis\Autoloader::register();
|
51 |
```
|
52 |
|
|
|
|
|
|
|
|
|
53 |
|
54 |
### Connecting to Redis ###
|
55 |
|
113 |
The actual list of supported connection parameters can vary depending on each connection backend so
|
114 |
it is recommended to refer to their specific documentation or implementation for details.
|
115 |
|
116 |
+
Predis can aggregate multiple connections when providing an array of connection parameters and the
|
117 |
+
appropriate option to instruct the client about how to aggregate them (clustering, replication or a
|
118 |
+
custom aggregation logic). Named arrays and URI strings can be mixed when providing configurations
|
119 |
for each node:
|
120 |
|
121 |
```php
|
122 |
$client = new Predis\Client([
|
123 |
+
'tcp://10.0.0.1?alias=first-node', ['host' => '10.0.0.2', 'alias' => 'second-node'],
|
124 |
+
], [
|
125 |
+
'cluster' => 'predis',
|
126 |
]);
|
127 |
```
|
128 |
|
141 |
second argument of `Predis\Client::__construct()`:
|
142 |
|
143 |
```php
|
144 |
+
$client = new Predis\Client($parameters, ['prefix' => 'sample:']);
|
145 |
```
|
146 |
|
147 |
Options are managed using a mini DI-alike container and their values can be lazily initialized only
|
148 |
when needed. The client options supported by default in Predis are:
|
149 |
|
150 |
+
- `prefix`: prefix string applied to every key found in commands.
|
|
|
151 |
- `exceptions`: whether the client should throw or return responses upon Redis errors.
|
152 |
- `connections`: list of connection backends or a connection factory instance.
|
153 |
+
- `cluster`: specifies a cluster backend (`predis`, `redis` or callable).
|
154 |
+
- `replication`: specifies a replication backend (`predis`, `sentinel` or callable).
|
155 |
+
- `aggregate`: configures the client with a custom aggregate connection (callable).
|
156 |
- `parameters`: list of default connection parameters for aggregate connections.
|
157 |
+
- `commands`: specifies a command factory instance to use through the library.
|
158 |
|
159 |
Users can also provide custom options with values or callable objects (for lazy initialization) that
|
160 |
are stored in the options container for later use through the library.
|
165 |
Aggregate connections are the foundation upon which Predis implements clustering and replication and
|
166 |
they are used to group multiple connections to single Redis nodes and hide the specific logic needed
|
167 |
to handle them properly depending on the context. Aggregate connections usually require an array of
|
168 |
+
connection parameters along with the appropriate client option when creating a new client instance.
|
169 |
|
170 |
#### Cluster ####
|
171 |
|
172 |
+
Predis can be configured to work in clustering mode with a traditional client-side sharding approach
|
173 |
+
to create a cluster of independent nodes and distribute the keyspace among them. This approach needs
|
174 |
+
some sort of external health monitoring of nodes and requires the keyspace to be rebalanced manually
|
175 |
+
when nodes are added or removed:
|
|
|
176 |
|
177 |
```php
|
178 |
$parameters = ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'];
|
179 |
+
$options = ['cluster' => 'predis'];
|
180 |
|
181 |
$client = new Predis\Client($parameters);
|
182 |
```
|
206 |
fall back to a different slave among the ones provided in the configuration.
|
207 |
|
208 |
The basic configuration needed to use the client in replication mode requires one Redis server to be
|
209 |
+
identified as the master (this can be done via connection parameters by setting the `role` parameter
|
210 |
+
to `master`) and one or more slaves (in this case setting `role` to `slave` for slaves is optional):
|
211 |
|
212 |
```php
|
213 |
+
$parameters = ['tcp://10.0.0.1?role=master', 'tcp://10.0.0.2', 'tcp://10.0.0.3'];
|
214 |
+
$options = ['replication' => 'predis'];
|
215 |
|
216 |
$client = new Predis\Client($parameters, $options);
|
217 |
```
|
252 |
the client to stick with slaves for their execution:
|
253 |
|
254 |
```php
|
255 |
+
$parameters = ['tcp://10.0.0.1?role=master', 'tcp://10.0.0.2', 'tcp://10.0.0.3'];
|
256 |
$options = ['replication' => function () {
|
257 |
// Set scripts that won't trigger a switch from a slave to the master node.
|
258 |
$strategy = new Predis\Replication\ReplicationStrategy();
|
259 |
$strategy->setScriptReadOnly($LUA_SCRIPT);
|
260 |
|
261 |
+
return new Predis\Connection\Replication\MasterSlaveReplication($strategy);
|
262 |
}];
|
263 |
|
264 |
$client = new Predis\Client($parameters, $options);
|
317 |
While we try to update Predis to stay up to date with all the commands available in Redis, you might
|
318 |
prefer to stick with an old version of the library or provide a different way to filter arguments or
|
319 |
parse responses for specific commands. To achieve that, Predis provides the ability to implement new
|
320 |
+
command classes to define or override commands in the default command factory used by the client:
|
321 |
|
322 |
```php
|
323 |
// Define a new command by extending Predis\Command\Command:
|
329 |
}
|
330 |
}
|
331 |
|
332 |
+
// Inject your command in the current command factory:
|
333 |
+
$client = new Predis\Client($parameters, [
|
334 |
+
'commands' => [
|
335 |
+
'newcmd' => 'BrandNewRedisCommand',
|
336 |
+
],
|
337 |
+
]);
|
338 |
|
339 |
$response = $client->newcmd();
|
340 |
```
|
353 |
While it is possible to leverage [Lua scripting](http://redis.io/commands/eval) on Redis 2.6+ using
|
354 |
directly [`EVAL`](http://redis.io/commands/eval) and [`EVALSHA`](http://redis.io/commands/evalsha),
|
355 |
Predis offers script commands as an higher level abstraction built upon them to make things simple.
|
356 |
+
Script commands can be registered in the command factory used by the client and are accessible as if
|
357 |
they were plain Redis commands, but they define Lua scripts that get transmitted to the server for
|
358 |
remote execution. Internally they use [`EVALSHA`](http://redis.io/commands/evalsha) by default and
|
359 |
identify a script by its SHA1 hash to save bandwidth, but [`EVAL`](http://redis.io/commands/eval)
|
379 |
}
|
380 |
}
|
381 |
|
382 |
+
// Inject the script command in the current command factory:
|
383 |
+
$client = new Predis\Client($parameters, [
|
384 |
+
'commands' => [
|
385 |
+
'lpushrand' => 'ListPushRandomValue',
|
386 |
+
],
|
387 |
+
]);
|
388 |
|
389 |
$response = $client->lpushrand('random_values', $seed = mt_rand());
|
390 |
```
|
406 |
]);
|
407 |
```
|
408 |
|
409 |
+
The client can also be configured to rely on a [phpiredis](https://github.com/nrk/phpiredis)-backend
|
410 |
+
by specifying a descriptive string for the `connections` client option. Supported string values are:
|
411 |
+
|
412 |
+
- `phpiredis-stream` maps `tcp`, `redis` and `unix` to `Predis\Connection\PhpiredisStreamConnection`
|
413 |
+
- `phpiredis-socket` maps `tcp`, `redis` and `unix` to `Predis\Connection\PhpiredisSocketConnection`
|
414 |
+
- `phpiredis` is simply an alias of `phpiredis-stream`
|
415 |
+
|
416 |
+
```php
|
417 |
+
$client = new Predis\Client('tcp://127.0.0.1', ['connections' => 'phpiredis']);
|
418 |
+
```
|
419 |
+
|
420 |
Developers can create their own connection classes to support whole new network backends, extend
|
421 |
existing classes or provide completely different implementations. Connection classes must implement
|
422 |
`Predis\Connection\NodeConnectionInterface` or extend `Predis\Connection\AbstractConnection`:
|
453 |
__ATTENTION__: Do not ever run the test suite shipped with Predis against instances of Redis running
|
454 |
in production environments or containing data you are interested in!
|
455 |
|
456 |
+
Predis has a comprehensive test suite covering every aspect of the library and that can optionally
|
457 |
+
perform integration tests against a running instance of Redis (required >= 2.4.0 in order to verify
|
458 |
+
the correct behavior of the implementation of each command. Integration tests for unsupported Redis
|
459 |
+
commands are automatically skipped. If you do not have Redis up and running, integration tests can
|
460 |
+
be disabled. See [the tests README](tests/README.md) for more details about testing this library.
|
|
|
|
|
|
|
|
|
461 |
|
462 |
+
Predis uses GitHub Actions for continuous integration and the history for past and current builds can be
|
463 |
+
found [on its actions page](https://github.com/predis/predis/actions).
|
464 |
|
465 |
|
466 |
## Other ##
|
471 |
- [Source code](https://github.com/predis/predis)
|
472 |
- [Wiki](https://github.com/predis/predis/wiki)
|
473 |
- [Issue tracker](https://github.com/predis/predis/issues)
|
|
|
474 |
|
475 |
|
476 |
### Author ###
|
477 |
|
478 |
- [Daniele Alessandri](mailto:suppakilla@gmail.com) ([twitter](http://twitter.com/JoL1hAHN))
|
479 |
+
- [Till Krüss](https://till.im) ([Twitter](http://twitter.com/tillkruss))
|
480 |
|
481 |
|
482 |
### License ###
|
487 |
[ico-version-stable]: https://img.shields.io/packagist/v/predis/predis.svg?style=flat-square
|
488 |
[ico-version-dev]: https://img.shields.io/packagist/vpre/predis/predis.svg?style=flat-square
|
489 |
[ico-downloads-monthly]: https://img.shields.io/packagist/dm/predis/predis.svg?style=flat-square
|
490 |
+
[ico-build]: https://img.shields.io/github/workflow/status/predis/predis/Tests/main?style=flat-square
|
|
|
491 |
|
492 |
[link-packagist]: https://packagist.org/packages/predis/predis
|
493 |
+
[link-actions]: https://github.com/predis/predis/actions
|
494 |
[link-downloads]: https://packagist.org/packages/predis/predis/stats
|
dependencies/predis/predis/VERSION
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
2.0.0
|
dependencies/predis/predis/bin/create-command-test
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
// of a test case to test a Redis command by specifying the name of the class
|
16 |
// in the Predis\Command namespace (only classes in this namespace are valid).
|
17 |
// For example, to generate a test case for SET (which is represented by the
|
18 |
-
// Predis\Command\StringSet class):
|
19 |
//
|
20 |
// $ ./bin/generate-command-test --class=StringSet
|
21 |
//
|
@@ -45,6 +45,11 @@ class CommandTestCaseGenerator
|
|
45 |
if (!isset($options['class'])) {
|
46 |
throw new RuntimeException("Missing 'class' option.");
|
47 |
}
|
|
|
|
|
|
|
|
|
|
|
48 |
$this->options = $options;
|
49 |
}
|
50 |
|
@@ -92,8 +97,12 @@ class CommandTestCaseGenerator
|
|
92 |
throw new RuntimeException("Missing 'class' option.");
|
93 |
}
|
94 |
|
95 |
-
$options['
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
|
98 |
$source = __DIR__.'/../src/'.$options['path'];
|
99 |
if (!file_exists($source)) {
|
@@ -101,7 +110,7 @@ class CommandTestCaseGenerator
|
|
101 |
}
|
102 |
|
103 |
if (!isset($options['output'])) {
|
104 |
-
$options['output'] = sprintf("%s/%s", $options['tests'], str_replace('.php', '
|
105 |
}
|
106 |
|
107 |
return new self($options);
|
@@ -109,18 +118,11 @@ class CommandTestCaseGenerator
|
|
109 |
|
110 |
protected function getTestRealm()
|
111 |
{
|
112 |
-
if (
|
113 |
-
|
114 |
-
throw new RuntimeException('Invalid value for realm has been sepcified (empty).');
|
115 |
-
}
|
116 |
-
return $this->options['realm'];
|
117 |
}
|
118 |
|
119 |
-
|
120 |
-
$class = array_pop($fqnParts);
|
121 |
-
list($realm,) = preg_split('/([[:upper:]][[:lower:]]+)/', $class, 2, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
122 |
-
|
123 |
-
return strtolower($realm);
|
124 |
}
|
125 |
|
126 |
public function generate()
|
@@ -130,6 +132,7 @@ class CommandTestCaseGenerator
|
|
130 |
if (!$reflection->isInstantiable()) {
|
131 |
throw new RuntimeException("Class $class must be instantiable, abstract classes or interfaces are not allowed.");
|
132 |
}
|
|
|
133 |
if (!$reflection->implementsInterface('Predis\Command\CommandInterface')) {
|
134 |
throw new RuntimeException("Class $class must implement Predis\Command\CommandInterface.");
|
135 |
}
|
@@ -173,7 +176,7 @@ class CommandTestCaseGenerator
|
|
173 |
* file that was distributed with this source code.
|
174 |
*/
|
175 |
|
176 |
-
namespace Predis\Command;
|
177 |
|
178 |
/**
|
179 |
* @group commands
|
@@ -184,7 +187,7 @@ class $class extends PredisCommandTestCase
|
|
184 |
/**
|
185 |
* {@inheritdoc}
|
186 |
*/
|
187 |
-
protected function getExpectedCommand()
|
188 |
{
|
189 |
return '$fqn';
|
190 |
}
|
@@ -192,7 +195,7 @@ class $class extends PredisCommandTestCase
|
|
192 |
/**
|
193 |
* {@inheritdoc}
|
194 |
*/
|
195 |
-
protected function getExpectedId()
|
196 |
{
|
197 |
return '$id';
|
198 |
}
|
@@ -200,7 +203,7 @@ class $class extends PredisCommandTestCase
|
|
200 |
/**
|
201 |
* @group disconnected
|
202 |
*/
|
203 |
-
public function testFilterArguments()
|
204 |
{
|
205 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
206 |
|
@@ -216,7 +219,7 @@ class $class extends PredisCommandTestCase
|
|
216 |
/**
|
217 |
* @group disconnected
|
218 |
*/
|
219 |
-
public function testParseResponse()
|
220 |
{
|
221 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
222 |
|
@@ -236,7 +239,7 @@ PHP;
|
|
236 |
/**
|
237 |
* @group disconnected
|
238 |
*/
|
239 |
-
public function testPrefixKeys()
|
240 |
{
|
241 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
242 |
|
@@ -252,7 +255,7 @@ PHP;
|
|
252 |
/**
|
253 |
* @group disconnected
|
254 |
*/
|
255 |
-
public function testPrefixKeysIgnoredOnEmptyArguments()
|
256 |
{
|
257 |
\$command = \$this->getCommand();
|
258 |
\$command->prefixKeys('prefix:');
|
15 |
// of a test case to test a Redis command by specifying the name of the class
|
16 |
// in the Predis\Command namespace (only classes in this namespace are valid).
|
17 |
// For example, to generate a test case for SET (which is represented by the
|
18 |
+
// Predis\Command\Redis\StringSet class):
|
19 |
//
|
20 |
// $ ./bin/generate-command-test --class=StringSet
|
21 |
//
|
45 |
if (!isset($options['class'])) {
|
46 |
throw new RuntimeException("Missing 'class' option.");
|
47 |
}
|
48 |
+
|
49 |
+
if (!isset($options['realm'])) {
|
50 |
+
throw new RuntimeException("Missing 'realm' option.");
|
51 |
+
}
|
52 |
+
|
53 |
$this->options = $options;
|
54 |
}
|
55 |
|
97 |
throw new RuntimeException("Missing 'class' option.");
|
98 |
}
|
99 |
|
100 |
+
if (!isset($options['realm'])) {
|
101 |
+
throw new RuntimeException("Missing 'realm' option.");
|
102 |
+
}
|
103 |
+
|
104 |
+
$options['fqn'] = "Predis\\Command\\Redis\\{$options['class']}";
|
105 |
+
$options['path'] = "Command/Redis/{$options['class']}.php";
|
106 |
|
107 |
$source = __DIR__.'/../src/'.$options['path'];
|
108 |
if (!file_exists($source)) {
|
110 |
}
|
111 |
|
112 |
if (!isset($options['output'])) {
|
113 |
+
$options['output'] = sprintf("%s/%s", $options['tests'], str_replace('.php', '_Test.php', $options['path']));
|
114 |
}
|
115 |
|
116 |
return new self($options);
|
118 |
|
119 |
protected function getTestRealm()
|
120 |
{
|
121 |
+
if (empty($this->options['realm'])) {
|
122 |
+
throw new RuntimeException('Invalid value for realm has been sepcified (empty).');
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
+
return $this->options['realm'];
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
public function generate()
|
132 |
if (!$reflection->isInstantiable()) {
|
133 |
throw new RuntimeException("Class $class must be instantiable, abstract classes or interfaces are not allowed.");
|
134 |
}
|
135 |
+
|
136 |
if (!$reflection->implementsInterface('Predis\Command\CommandInterface')) {
|
137 |
throw new RuntimeException("Class $class must implement Predis\Command\CommandInterface.");
|
138 |
}
|
176 |
* file that was distributed with this source code.
|
177 |
*/
|
178 |
|
179 |
+
namespace Predis\Command\Redis;
|
180 |
|
181 |
/**
|
182 |
* @group commands
|
187 |
/**
|
188 |
* {@inheritdoc}
|
189 |
*/
|
190 |
+
protected function getExpectedCommand(): string
|
191 |
{
|
192 |
return '$fqn';
|
193 |
}
|
195 |
/**
|
196 |
* {@inheritdoc}
|
197 |
*/
|
198 |
+
protected function getExpectedId(): string
|
199 |
{
|
200 |
return '$id';
|
201 |
}
|
203 |
/**
|
204 |
* @group disconnected
|
205 |
*/
|
206 |
+
public function testFilterArguments(): void
|
207 |
{
|
208 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
209 |
|
219 |
/**
|
220 |
* @group disconnected
|
221 |
*/
|
222 |
+
public function testParseResponse(): void
|
223 |
{
|
224 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
225 |
|
239 |
/**
|
240 |
* @group disconnected
|
241 |
*/
|
242 |
+
public function testPrefixKeys(): void
|
243 |
{
|
244 |
\$this->markTestIncomplete('This test has not been implemented yet.');
|
245 |
|
255 |
/**
|
256 |
* @group disconnected
|
257 |
*/
|
258 |
+
public function testPrefixKeysIgnoredOnEmptyArguments(): void
|
259 |
{
|
260 |
\$command = \$this->getCommand();
|
261 |
\$command->prefixKeys('prefix:');
|
dependencies/predis/predis/bin/create-pear
DELETED
@@ -1,233 +0,0 @@
|
|
1 |
-
#!/usr/bin/env php
|
2 |
-
<?php
|
3 |
-
|
4 |
-
/*
|
5 |
-
* This file is part of the Predis package.
|
6 |
-
*
|
7 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
8 |
-
*
|
9 |
-
* For the full copyright and license information, please view the LICENSE
|
10 |
-
* file that was distributed with this source code.
|
11 |
-
*/
|
12 |
-
|
13 |
-
// -------------------------------------------------------------------------- //
|
14 |
-
// In order to be able to execute this script to create a PEAR package of Predis
|
15 |
-
// the `pear` binary must be available and executable in your $PATH.
|
16 |
-
// The parts used to parse author and version strings are taken from Onion (used
|
17 |
-
// by this library in the past) just to keep on relying on the package.ini file
|
18 |
-
// to simplify things. We might consider to switch to using the PEAR classes
|
19 |
-
// directly in the future.
|
20 |
-
// -------------------------------------------------------------------------- //
|
21 |
-
|
22 |
-
function executeWithBackup($file, $callback)
|
23 |
-
{
|
24 |
-
$exception = null;
|
25 |
-
$backup = "$file.backup";
|
26 |
-
|
27 |
-
copy($file, $backup);
|
28 |
-
|
29 |
-
try {
|
30 |
-
call_user_func($callback, $file);
|
31 |
-
} catch (Exception $exception) {
|
32 |
-
// NOOP
|
33 |
-
}
|
34 |
-
|
35 |
-
unlink($file);
|
36 |
-
rename($backup, $file);
|
37 |
-
|
38 |
-
if ($exception) {
|
39 |
-
throw $exception;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
function parseAuthor($string)
|
44 |
-
{
|
45 |
-
$author = array();
|
46 |
-
|
47 |
-
if (preg_match('/^\s*(.+?)\s*(?:"(\S+)"\s*)?<(\S+)>\s*$/x', $string , $regs)) {
|
48 |
-
if (count($regs) == 4) {
|
49 |
-
list($_,$name,$user,$email) = $regs;
|
50 |
-
$author['name'] = $name;
|
51 |
-
$author['user'] = $user;
|
52 |
-
$author['email'] = $email;
|
53 |
-
} elseif (count($regs) == 3) {
|
54 |
-
list($_,$name,$email) = $regs;
|
55 |
-
$author['name'] = $name;
|
56 |
-
$author['email'] = $email;
|
57 |
-
}
|
58 |
-
} else {
|
59 |
-
$author['name'] = $string;
|
60 |
-
}
|
61 |
-
|
62 |
-
return $author;
|
63 |
-
}
|
64 |
-
|
65 |
-
function parseVersion($string)
|
66 |
-
{
|
67 |
-
$version_pattern = '([0-9.]+)';
|
68 |
-
|
69 |
-
if (preg_match("/^\s*$version_pattern\s*\$/x", $string, $regs)) {
|
70 |
-
return array('min' => $regs[1] ?: '0.0.0');
|
71 |
-
} elseif (preg_match("/^\s*[>=]+\s*$version_pattern\s*\$/x", $string, $regs)) {
|
72 |
-
return array('min' => $regs[1] ?: '0.0.0');
|
73 |
-
} elseif (preg_match("/^\s*[<=]+\s*$version_pattern\s*\$/x", $string, $regs)) {
|
74 |
-
return array('max' => $regs[1]);
|
75 |
-
} elseif (preg_match("/^\s*$version_pattern\s*<=>\s*$version_pattern\s*\$/x", $string, $regs)) {
|
76 |
-
return array(
|
77 |
-
'min' => $regs[1] ?: '0.0.0',
|
78 |
-
'max' => $regs[2],
|
79 |
-
);
|
80 |
-
}
|
81 |
-
|
82 |
-
return null;
|
83 |
-
}
|
84 |
-
|
85 |
-
function addRolePath($pkg, $path, $role)
|
86 |
-
{
|
87 |
-
if (is_dir($path)) {
|
88 |
-
$dirRoot = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
|
89 |
-
$dirTree = new RecursiveIteratorIterator($dirRoot, RecursiveIteratorIterator::CHILD_FIRST);
|
90 |
-
|
91 |
-
foreach ($dirTree as $fileinfo) {
|
92 |
-
if ($fileinfo->isFile()) {
|
93 |
-
addPackageFile($pkg, $fileinfo, $role, $path);
|
94 |
-
}
|
95 |
-
}
|
96 |
-
} else {
|
97 |
-
foreach (glob($path) as $filename) {
|
98 |
-
addPackageFile($pkg, new SplFileInfo($filename), $role);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
function addPackageFile($pkg, $fileinfo, $role, $baseDir = '')
|
104 |
-
{
|
105 |
-
$fileNode = $pkg->contents->dir->addChild('file');
|
106 |
-
$fileNode->addAttribute('name', $filepath = $fileinfo->getPathname());
|
107 |
-
$fileNode->addAttribute('role', $role);
|
108 |
-
$fileNode->addAttribute('md5sum', md5_file($filepath));
|
109 |
-
|
110 |
-
$installNode = $pkg->phprelease->filelist->addChild('install');
|
111 |
-
$installNode->addAttribute('name', $filepath);
|
112 |
-
$installNode->addAttribute('as', !$baseDir ? basename($filepath) : substr($filepath, strlen($baseDir) + 1));
|
113 |
-
}
|
114 |
-
|
115 |
-
function generatePackageXml($packageINI)
|
116 |
-
{
|
117 |
-
$XML = <<<XML
|
118 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
119 |
-
<package packagerversion="1.4.10" version="2.0"
|
120 |
-
xmlns="http://pear.php.net/dtd/package-2.0"
|
121 |
-
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
|
122 |
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
123 |
-
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
124 |
-
http://pear.php.net/dtd/tasks-1.0.xsd
|
125 |
-
http://pear.php.net/dtd/package-2.0
|
126 |
-
http://pear.php.net/dtd/package-2.0.xsd" />
|
127 |
-
XML;
|
128 |
-
|
129 |
-
$cfg = parse_ini_file($packageINI, true);
|
130 |
-
$pkg = new SimpleXMLElement($XML);
|
131 |
-
|
132 |
-
$pkg->name = $cfg['package']['name'];
|
133 |
-
$pkg->channel = $cfg['package']['channel'];
|
134 |
-
$pkg->summary = $cfg['package']['desc'];
|
135 |
-
$pkg->description = $cfg['package']['desc'];
|
136 |
-
|
137 |
-
$author = parseAuthor($cfg['package']['author']);
|
138 |
-
$pkg->addChild('lead');
|
139 |
-
$pkg->lead->name = $author['name'];
|
140 |
-
$pkg->lead->user = $author['user'];
|
141 |
-
$pkg->lead->email = $author['email'];
|
142 |
-
$pkg->lead->active = 'yes';
|
143 |
-
|
144 |
-
$datetime = new DateTime('now');
|
145 |
-
$pkg->date = $datetime->format('Y-m-d');
|
146 |
-
$pkg->time = $datetime->format('H:i:s');
|
147 |
-
|
148 |
-
$pkg->addChild('version');
|
149 |
-
$pkg->version->release = $cfg['package']['version'];
|
150 |
-
$pkg->version->api = $cfg['package']['version'];
|
151 |
-
|
152 |
-
$pkg->addChild('stability');
|
153 |
-
$pkg->stability->release = $cfg['package']['stability'];
|
154 |
-
$pkg->stability->api = $cfg['package']['stability'];
|
155 |
-
|
156 |
-
$pkg->license = $cfg['package']['license'];
|
157 |
-
$pkg->notes = '-';
|
158 |
-
|
159 |
-
$pkg->addChild('contents')->addChild('dir')->addAttribute('name', '/');
|
160 |
-
|
161 |
-
$pkg->addChild('dependencies')->addChild('required');
|
162 |
-
foreach ($cfg['require'] as $required => $version) {
|
163 |
-
$version = parseVersion($version);
|
164 |
-
$pkg->dependencies->required->addChild($required);
|
165 |
-
|
166 |
-
if (isset($version['min'])) {
|
167 |
-
$pkg->dependencies->required->$required->min = $version['min'];
|
168 |
-
}
|
169 |
-
if (isset($version['max'])) {
|
170 |
-
$pkg->dependencies->required->$required->min = $version['max'];
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
$pkg->addChild('phprelease')->addChild('filelist');
|
175 |
-
|
176 |
-
$pathToRole = array(
|
177 |
-
'doc' => 'doc', 'docs' => 'doc', 'examples' => 'doc',
|
178 |
-
'lib' => 'php', 'src' => 'php',
|
179 |
-
'test' => 'test', 'tests' => 'test',
|
180 |
-
);
|
181 |
-
|
182 |
-
foreach (array_merge($pathToRole, $cfg['roles'] ?: array()) as $path => $role) {
|
183 |
-
addRolePath($pkg, $path, $role);
|
184 |
-
}
|
185 |
-
|
186 |
-
return $pkg;
|
187 |
-
}
|
188 |
-
|
189 |
-
function rewritePackageInstallAs($pkg)
|
190 |
-
{
|
191 |
-
foreach ($pkg->phprelease->filelist->install as $file) {
|
192 |
-
if (preg_match('/^src\//', $file['name'])) {
|
193 |
-
$file['as'] = "Predis/{$file['as']}";
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
function savePackageXml($xml)
|
199 |
-
{
|
200 |
-
$dom = new DOMDocument("1.0", "UTF-8");
|
201 |
-
$dom->preserveWhiteSpace = false;
|
202 |
-
$dom->formatOutput = true;
|
203 |
-
$dom->loadXML($xml->asXML());
|
204 |
-
|
205 |
-
file_put_contents('package.xml', $dom->saveXML());
|
206 |
-
}
|
207 |
-
|
208 |
-
function buildPackage()
|
209 |
-
{
|
210 |
-
passthru('pear -q package && rm package.xml');
|
211 |
-
}
|
212 |
-
|
213 |
-
function modifyPhpunitXml($file)
|
214 |
-
{
|
215 |
-
$cfg = new SimpleXMLElement($file, null, true);
|
216 |
-
|
217 |
-
$cfg[0]['bootstrap'] = str_replace('tests/', '', $cfg[0]['bootstrap']);
|
218 |
-
$cfg->testsuites->testsuite->directory = str_replace('tests/', '', $cfg->testsuites->testsuite->directory);
|
219 |
-
|
220 |
-
$cfg->saveXml($file);
|
221 |
-
}
|
222 |
-
|
223 |
-
// -------------------------------------------------------------------------- //
|
224 |
-
|
225 |
-
executeWithBackup(__DIR__.'/../phpunit.xml.dist', function ($file) {
|
226 |
-
modifyPhpunitXml($file);
|
227 |
-
|
228 |
-
$pkg = generatePackageXml('package.ini');
|
229 |
-
rewritePackageInstallAs($pkg);
|
230 |
-
savePackageXml($pkg);
|
231 |
-
|
232 |
-
buildPackage();
|
233 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/bin/create-phar
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
#!/usr/bin/env php
|
2 |
-
<?php
|
3 |
-
|
4 |
-
/*
|
5 |
-
* This file is part of the Predis package.
|
6 |
-
*
|
7 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
8 |
-
*
|
9 |
-
* For the full copyright and license information, please view the LICENSE
|
10 |
-
* file that was distributed with this source code.
|
11 |
-
*/
|
12 |
-
|
13 |
-
// -------------------------------------------------------------------------- //
|
14 |
-
// In order to be able to execute this script to create a Phar archive of Predis,
|
15 |
-
// the Phar module must be loaded and the "phar.readonly" directive php.ini must
|
16 |
-
// be set to "off". You can change the values in the $options array to customize
|
17 |
-
// the creation of the Phar archive to better suit your needs.
|
18 |
-
// -------------------------------------------------------------------------- //
|
19 |
-
|
20 |
-
$options = array(
|
21 |
-
'name' => 'predis',
|
22 |
-
'project_path' => __DIR__ . '/../src',
|
23 |
-
'compression' => Phar::NONE,
|
24 |
-
'append_version' => true,
|
25 |
-
);
|
26 |
-
|
27 |
-
function getPharFilename($options)
|
28 |
-
{
|
29 |
-
$filename = $options['name'];
|
30 |
-
|
31 |
-
// NOTE: do not consider "append_version" with Phar compression do to a bug in
|
32 |
-
// Phar::compress() when renaming phar archives containing dots in their name.
|
33 |
-
if ($options['append_version'] && $options['compression'] === Phar::NONE) {
|
34 |
-
$versionFile = @fopen(__DIR__ . '/../VERSION', 'r');
|
35 |
-
|
36 |
-
if ($versionFile === false) {
|
37 |
-
throw new Exception("Could not locate the VERSION file.");
|
38 |
-
}
|
39 |
-
|
40 |
-
$version = trim(fgets($versionFile));
|
41 |
-
fclose($versionFile);
|
42 |
-
$filename .= "_$version";
|
43 |
-
}
|
44 |
-
|
45 |
-
return "$filename.phar";
|
46 |
-
}
|
47 |
-
|
48 |
-
function getPharStub($options)
|
49 |
-
{
|
50 |
-
return <<<EOSTUB
|
51 |
-
<?php
|
52 |
-
Phar::mapPhar('predis.phar');
|
53 |
-
spl_autoload_register(function (\$class) {
|
54 |
-
if (strpos(\$class, 'Predis\\\\') === 0) {
|
55 |
-
\$file = 'phar://predis.phar/'.strtr(substr(\$class, 7), '\\\', '/').'.php';
|
56 |
-
if (file_exists(\$file)) {
|
57 |
-
require \$file;
|
58 |
-
return true;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
});
|
62 |
-
__halt_compiler();
|
63 |
-
EOSTUB;
|
64 |
-
}
|
65 |
-
|
66 |
-
// -------------------------------------------------------------------------- //
|
67 |
-
|
68 |
-
$phar = new Phar(getPharFilename($options));
|
69 |
-
$phar->compress($options['compression']);
|
70 |
-
$phar->setStub(getPharStub($options));
|
71 |
-
$phar->buildFromDirectory($options['project_path']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/bin/create-single-file
DELETED
@@ -1,662 +0,0 @@
|
|
1 |
-
#!/usr/bin/env php
|
2 |
-
<?php
|
3 |
-
|
4 |
-
/*
|
5 |
-
* This file is part of the Predis package.
|
6 |
-
*
|
7 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
8 |
-
*
|
9 |
-
* For the full copyright and license information, please view the LICENSE
|
10 |
-
* file that was distributed with this source code.
|
11 |
-
*/
|
12 |
-
|
13 |
-
// -------------------------------------------------------------------------- //
|
14 |
-
// This script can be used to automatically glue all the .php files of Predis
|
15 |
-
// into a single monolithic script file that can be used without an autoloader,
|
16 |
-
// just like the other previous versions of the library.
|
17 |
-
//
|
18 |
-
// Much of its complexity is due to the fact that we cannot simply join PHP
|
19 |
-
// files, but namespaces and classes definitions must follow a precise order
|
20 |
-
// when dealing with subclassing and inheritance.
|
21 |
-
//
|
22 |
-
// The current implementation is pretty naïve, but it should do for now.
|
23 |
-
// -------------------------------------------------------------------------- //
|
24 |
-
|
25 |
-
class CommandLine
|
26 |
-
{
|
27 |
-
public static function getOptions()
|
28 |
-
{
|
29 |
-
$parameters = array(
|
30 |
-
's:' => 'source:',
|
31 |
-
'o:' => 'output:',
|
32 |
-
'e:' => 'exclude:',
|
33 |
-
'E:' => 'exclude-classes:',
|
34 |
-
);
|
35 |
-
|
36 |
-
$getops = getopt(implode(array_keys($parameters)), $parameters);
|
37 |
-
|
38 |
-
$options = array(
|
39 |
-
'source' => __DIR__ . "/../src",
|
40 |
-
'output' => PredisFile::NS_ROOT . '.php',
|
41 |
-
'exclude' => array(),
|
42 |
-
);
|
43 |
-
|
44 |
-
foreach ($getops as $option => $value) {
|
45 |
-
switch ($option) {
|
46 |
-
case 's':
|
47 |
-
case 'source':
|
48 |
-
$options['source'] = $value;
|
49 |
-
break;
|
50 |
-
|
51 |
-
case 'o':
|
52 |
-
case 'output':
|
53 |
-
$options['output'] = $value;
|
54 |
-
break;
|
55 |
-
|
56 |
-
case 'E':
|
57 |
-
case 'exclude-classes':
|
58 |
-
$options['exclude'] = @file($value, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: $value;
|
59 |
-
break;
|
60 |
-
|
61 |
-
case 'e':
|
62 |
-
case 'exclude':
|
63 |
-
$options['exclude'] = is_array($value) ? $value : array($value);
|
64 |
-
break;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
return $options;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
class PredisFile
|
73 |
-
{
|
74 |
-
const NS_ROOT = 'Predis';
|
75 |
-
|
76 |
-
private $namespaces;
|
77 |
-
|
78 |
-
public function __construct()
|
79 |
-
{
|
80 |
-
$this->namespaces = array();
|
81 |
-
}
|
82 |
-
|
83 |
-
public static function from($libraryPath, array $exclude = array())
|
84 |
-
{
|
85 |
-
$predisFile = new PredisFile();
|
86 |
-
$libIterator = new RecursiveDirectoryIterator($libraryPath);
|
87 |
-
|
88 |
-
foreach (new RecursiveIteratorIterator($libIterator) as $classFile)
|
89 |
-
{
|
90 |
-
if (!$classFile->isFile()) {
|
91 |
-
continue;
|
92 |
-
}
|
93 |
-
|
94 |
-
$namespace = self::NS_ROOT.strtr(str_replace($libraryPath, '', $classFile->getPath()), '/', '\\');
|
95 |
-
|
96 |
-
if (in_array(sprintf('%s\\%s', $namespace, $classFile->getBasename('.php')), $exclude)) {
|
97 |
-
continue;
|
98 |
-
}
|
99 |
-
|
100 |
-
$phpNamespace = $predisFile->getNamespace($namespace);
|
101 |
-
|
102 |
-
if ($phpNamespace === false) {
|
103 |
-
$phpNamespace = new PhpNamespace($namespace);
|
104 |
-
$predisFile->addNamespace($phpNamespace);
|
105 |
-
}
|
106 |
-
|
107 |
-
$phpClass = new PhpClass($phpNamespace, $classFile);
|
108 |
-
}
|
109 |
-
|
110 |
-
return $predisFile;
|
111 |
-
}
|
112 |
-
|
113 |
-
public function addNamespace(PhpNamespace $namespace)
|
114 |
-
{
|
115 |
-
if (isset($this->namespaces[(string)$namespace])) {
|
116 |
-
throw new InvalidArgumentException("Duplicated namespace");
|
117 |
-
}
|
118 |
-
$this->namespaces[(string)$namespace] = $namespace;
|
119 |
-
}
|
120 |
-
|
121 |
-
public function getNamespaces()
|
122 |
-
{
|
123 |
-
return $this->namespaces;
|
124 |
-
}
|
125 |
-
|
126 |
-
public function getNamespace($namespace)
|
127 |
-
{
|
128 |
-
if (!isset($this->namespaces[$namespace])) {
|
129 |
-
return false;
|
130 |
-
}
|
131 |
-
|
132 |
-
return $this->namespaces[$namespace];
|
133 |
-
}
|
134 |
-
|
135 |
-
public function getClassByFQN($classFqn)
|
136 |
-
{
|
137 |
-
if (($nsLastPos = strrpos($classFqn, '\\')) !== false) {
|
138 |
-
$namespace = $this->getNamespace(substr($classFqn, 0, $nsLastPos));
|
139 |
-
if ($namespace === false) {
|
140 |
-
return null;
|
141 |
-
}
|
142 |
-
$className = substr($classFqn, $nsLastPos + 1);
|
143 |
-
|
144 |
-
return $namespace->getClass($className);
|
145 |
-
}
|
146 |
-
|
147 |
-
return null;
|
148 |
-
}
|
149 |
-
|
150 |
-
private function calculateDependencyScores(&$classes, $fqn)
|
151 |
-
{
|
152 |
-
if (!isset($classes[$fqn])) {
|
153 |
-
$classes[$fqn] = 0;
|
154 |
-
}
|
155 |
-
|
156 |
-
$classes[$fqn] += 1;
|
157 |
-
|
158 |
-
if (($phpClass = $this->getClassByFQN($fqn)) === null) {
|
159 |
-
throw new RuntimeException(
|
160 |
-
"Cannot found the class $fqn which is required by other subclasses. Are you missing a file?"
|
161 |
-
);
|
162 |
-
}
|
163 |
-
|
164 |
-
foreach ($phpClass->getDependencies() as $fqn) {
|
165 |
-
$this->calculateDependencyScores($classes, $fqn);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
private function getDependencyScores()
|
170 |
-
{
|
171 |
-
$classes = array();
|
172 |
-
|
173 |
-
foreach ($this->getNamespaces() as $phpNamespace) {
|
174 |
-
foreach ($phpNamespace->getClasses() as $phpClass) {
|
175 |
-
$this->calculateDependencyScores($classes, $phpClass->getFQN());
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
return $classes;
|
180 |
-
}
|
181 |
-
|
182 |
-
private function getOrderedNamespaces($dependencyScores)
|
183 |
-
{
|
184 |
-
$namespaces = array_fill_keys(array_unique(
|
185 |
-
array_map(
|
186 |
-
function ($fqn) { return PhpNamespace::extractName($fqn); },
|
187 |
-
array_keys($dependencyScores)
|
188 |
-
)
|
189 |
-
), 0);
|
190 |
-
|
191 |
-
foreach ($dependencyScores as $classFqn => $score) {
|
192 |
-
$namespaces[PhpNamespace::extractName($classFqn)] += $score;
|
193 |
-
}
|
194 |
-
|
195 |
-
arsort($namespaces);
|
196 |
-
|
197 |
-
return array_keys($namespaces);
|
198 |
-
}
|
199 |
-
|
200 |
-
private function getOrderedClasses(PhpNamespace $phpNamespace, $classes)
|
201 |
-
{
|
202 |
-
$nsClassesFQNs = array_map(function ($cl) { return $cl->getFQN(); }, $phpNamespace->getClasses());
|
203 |
-
$nsOrderedClasses = array();
|
204 |
-
|
205 |
-
foreach ($nsClassesFQNs as $nsClassFQN) {
|
206 |
-
$nsOrderedClasses[$nsClassFQN] = $classes[$nsClassFQN];
|
207 |
-
}
|
208 |
-
|
209 |
-
arsort($nsOrderedClasses);
|
210 |
-
|
211 |
-
return array_keys($nsOrderedClasses);
|
212 |
-
}
|
213 |
-
|
214 |
-
public function getPhpCode()
|
215 |
-
{
|
216 |
-
$buffer = array("<?php\n\n", PhpClass::LICENSE_HEADER, "\n\n");
|
217 |
-
$classes = $this->getDependencyScores();
|
218 |
-
$namespaces = $this->getOrderedNamespaces($classes);
|
219 |
-
|
220 |
-
foreach ($namespaces as $namespace) {
|
221 |
-
$phpNamespace = $this->getNamespace($namespace);
|
222 |
-
|
223 |
-
// generate namespace directive
|
224 |
-
$buffer[] = $phpNamespace->getPhpCode();
|
225 |
-
$buffer[] = "\n";
|
226 |
-
|
227 |
-
// generate use directives
|
228 |
-
$useDirectives = $phpNamespace->getUseDirectives();
|
229 |
-
if (count($useDirectives) > 0) {
|
230 |
-
$buffer[] = $useDirectives->getPhpCode();
|
231 |
-
$buffer[] = "\n";
|
232 |
-
}
|
233 |
-
|
234 |
-
// generate classes bodies
|
235 |
-
$nsClasses = $this->getOrderedClasses($phpNamespace, $classes);
|
236 |
-
foreach ($nsClasses as $classFQN) {
|
237 |
-
$buffer[] = $this->getClassByFQN($classFQN)->getPhpCode();
|
238 |
-
$buffer[] = "\n\n";
|
239 |
-
}
|
240 |
-
|
241 |
-
$buffer[] = "/* " . str_repeat("-", 75) . " */";
|
242 |
-
$buffer[] = "\n\n";
|
243 |
-
}
|
244 |
-
|
245 |
-
return implode($buffer);
|
246 |
-
}
|
247 |
-
|
248 |
-
public function saveTo($outputFile)
|
249 |
-
{
|
250 |
-
// TODO: add more sanity checks
|
251 |
-
if ($outputFile === null || $outputFile === '') {
|
252 |
-
throw new InvalidArgumentException('You must specify a valid output file');
|
253 |
-
}
|
254 |
-
file_put_contents($outputFile, $this->getPhpCode());
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
class PhpNamespace implements IteratorAggregate
|
259 |
-
{
|
260 |
-
private $namespace;
|
261 |
-
private $classes;
|
262 |
-
|
263 |
-
public function __construct($namespace)
|
264 |
-
{
|
265 |
-
$this->namespace = $namespace;
|
266 |
-
$this->classes = array();
|
267 |
-
$this->useDirectives = new PhpUseDirectives($this);
|
268 |
-
}
|
269 |
-
|
270 |
-
public static function extractName($fqn)
|
271 |
-
{
|
272 |
-
$nsSepLast = strrpos($fqn, '\\');
|
273 |
-
if ($nsSepLast === false) {
|
274 |
-
return $fqn;
|
275 |
-
}
|
276 |
-
$ns = substr($fqn, 0, $nsSepLast);
|
277 |
-
|
278 |
-
return $ns !== '' ? $ns : null;
|
279 |
-
}
|
280 |
-
|
281 |
-
public function addClass(PhpClass $class)
|
282 |
-
{
|
283 |
-
$this->classes[$class->getName()] = $class;
|
284 |
-
}
|
285 |
-
|
286 |
-
public function getClass($className)
|
287 |
-
{
|
288 |
-
if (isset($this->classes[$className])) {
|
289 |
-
return $this->classes[$className];
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
public function getClasses()
|
294 |
-
{
|
295 |
-
return array_values($this->classes);
|
296 |
-
}
|
297 |
-
|
298 |
-
public function getIterator()
|
299 |
-
{
|
300 |
-
return new \ArrayIterator($this->getClasses());
|
301 |
-
}
|
302 |
-
|
303 |
-
public function getUseDirectives()
|
304 |
-
{
|
305 |
-
return $this->useDirectives;
|
306 |
-
}
|
307 |
-
|
308 |
-
public function getPhpCode()
|
309 |
-
{
|
310 |
-
return "namespace $this->namespace;\n";
|
311 |
-
}
|
312 |
-
|
313 |
-
public function __toString()
|
314 |
-
{
|
315 |
-
return $this->namespace;
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
class PhpUseDirectives implements Countable, IteratorAggregate
|
320 |
-
{
|
321 |
-
private $use;
|
322 |
-
private $aliases;
|
323 |
-
private $reverseAliases;
|
324 |
-
private $namespace;
|
325 |
-
|
326 |
-
public function __construct(PhpNamespace $namespace)
|
327 |
-
{
|
328 |
-
$this->namespace = $namespace;
|
329 |
-
$this->use = array();
|
330 |
-
$this->aliases = array();
|
331 |
-
$this->reverseAliases = array();
|
332 |
-
}
|
333 |
-
|
334 |
-
public function add($use, $as = null)
|
335 |
-
{
|
336 |
-
if (in_array($use, $this->use)) {
|
337 |
-
return;
|
338 |
-
}
|
339 |
-
|
340 |
-
$rename = null;
|
341 |
-
$this->use[] = $use;
|
342 |
-
$aliasedClassName = $as ?: PhpClass::extractName($use);
|
343 |
-
|
344 |
-
if (isset($this->aliases[$aliasedClassName])) {
|
345 |
-
$parentNs = $this->getParentNamespace();
|
346 |
-
|
347 |
-
if ($parentNs && false !== $pos = strrpos($parentNs, '\\')) {
|
348 |
-
$parentNs = substr($parentNs, $pos);
|
349 |
-
}
|
350 |
-
|
351 |
-
$newAlias = "{$parentNs}_{$aliasedClassName}";
|
352 |
-
$rename = (object) array(
|
353 |
-
'namespace' => $this->namespace,
|
354 |
-
'from' => $aliasedClassName,
|
355 |
-
'to' => $newAlias,
|
356 |
-
);
|
357 |
-
|
358 |
-
$this->aliases[$newAlias] = $use;
|
359 |
-
$as = $newAlias;
|
360 |
-
} else {
|
361 |
-
$this->aliases[$aliasedClassName] = $use;
|
362 |
-
}
|
363 |
-
|
364 |
-
if ($as !== null) {
|
365 |
-
$this->reverseAliases[$use] = $as;
|
366 |
-
}
|
367 |
-
|
368 |
-
return $rename;
|
369 |
-
}
|
370 |
-
|
371 |
-
public function getList()
|
372 |
-
{
|
373 |
-
return $this->use;
|
374 |
-
}
|
375 |
-
|
376 |
-
public function getIterator()
|
377 |
-
{
|
378 |
-
return new \ArrayIterator($this->getList());
|
379 |
-
}
|
380 |
-
|
381 |
-
public function getPhpCode()
|
382 |
-
{
|
383 |
-
$reverseAliases = $this->reverseAliases;
|
384 |
-
|
385 |
-
$reducer = function ($str, $use) use ($reverseAliases) {
|
386 |
-
if (isset($reverseAliases[$use])) {
|
387 |
-
return $str .= "use $use as {$reverseAliases[$use]};\n";
|
388 |
-
} else {
|
389 |
-
return $str .= "use $use;\n";
|
390 |
-
}
|
391 |
-
};
|
392 |
-
|
393 |
-
return array_reduce($this->getList(), $reducer, '');
|
394 |
-
}
|
395 |
-
|
396 |
-
public function getNamespace()
|
397 |
-
{
|
398 |
-
return $this->namespace;
|
399 |
-
}
|
400 |
-
|
401 |
-
public function getParentNamespace()
|
402 |
-
{
|
403 |
-
if (false !== $pos = strrpos($this->namespace, '\\')) {
|
404 |
-
return substr($this->namespace, 0, $pos);
|
405 |
-
}
|
406 |
-
|
407 |
-
return '';
|
408 |
-
}
|
409 |
-
|
410 |
-
public function getFQN($className)
|
411 |
-
{
|
412 |
-
if (($nsSepFirst = strpos($className, '\\')) === false) {
|
413 |
-
if (isset($this->aliases[$className])) {
|
414 |
-
return $this->aliases[$className];
|
415 |
-
}
|
416 |
-
|
417 |
-
return (string)$this->getNamespace() . "\\$className";
|
418 |
-
}
|
419 |
-
|
420 |
-
if ($nsSepFirst != 0) {
|
421 |
-
throw new InvalidArgumentException("Partially qualified names are not supported");
|
422 |
-
}
|
423 |
-
|
424 |
-
return $className;
|
425 |
-
}
|
426 |
-
|
427 |
-
public function count()
|
428 |
-
{
|
429 |
-
return count($this->use);
|
430 |
-
}
|
431 |
-
}
|
432 |
-
|
433 |
-
class PhpClass
|
434 |
-
{
|
435 |
-
const LICENSE_HEADER = <<<LICENSE
|
436 |
-
/*
|
437 |
-
* This file is part of the Predis package.
|
438 |
-
*
|
439 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
440 |
-
*
|
441 |
-
* For the full copyright and license information, please view the LICENSE
|
442 |
-
* file that was distributed with this source code.
|
443 |
-
*/
|
444 |
-
LICENSE;
|
445 |
-
|
446 |
-
private $namespace;
|
447 |
-
private $file;
|
448 |
-
private $body;
|
449 |
-
private $implements;
|
450 |
-
private $extends;
|
451 |
-
private $name;
|
452 |
-
|
453 |
-
public function __construct(PhpNamespace $namespace, SplFileInfo $classFile)
|
454 |
-
{
|
455 |
-
$this->namespace = $namespace;
|
456 |
-
$this->file = $classFile;
|
457 |
-
$this->implements = array();
|
458 |
-
$this->extends = array();
|
459 |
-
|
460 |
-
$this->extractData();
|
461 |
-
$namespace->addClass($this);
|
462 |
-
}
|
463 |
-
|
464 |
-
public static function extractName($fqn)
|
465 |
-
{
|
466 |
-
$nsSepLast = strrpos($fqn, '\\');
|
467 |
-
if ($nsSepLast === false) {
|
468 |
-
return $fqn;
|
469 |
-
}
|
470 |
-
|
471 |
-
return substr($fqn, $nsSepLast + 1);
|
472 |
-
}
|
473 |
-
|
474 |
-
private function extractData()
|
475 |
-
{
|
476 |
-
$renames = array();
|
477 |
-
$useDirectives = $this->getNamespace()->getUseDirectives();
|
478 |
-
|
479 |
-
$useExtractor = function ($m) use ($useDirectives, &$renames) {
|
480 |
-
array_shift($m);
|
481 |
-
|
482 |
-
if (isset($m[1])) {
|
483 |
-
$m[1] = str_replace(" as ", '', $m[1]);
|
484 |
-
}
|
485 |
-
|
486 |
-
if ($rename = call_user_func_array(array($useDirectives, 'add'), $m)) {
|
487 |
-
$renames[] = $rename;
|
488 |
-
}
|
489 |
-
};
|
490 |
-
|
491 |
-
$classBuffer = stream_get_contents(fopen($this->getFile()->getPathname(), 'r'));
|
492 |
-
|
493 |
-
$classBuffer = str_replace(self::LICENSE_HEADER, '', $classBuffer);
|
494 |
-
|
495 |
-
$classBuffer = preg_replace('/<\?php\s?\\n\s?/', '', $classBuffer);
|
496 |
-
$classBuffer = preg_replace('/\s?\?>\n?/ms', '', $classBuffer);
|
497 |
-
$classBuffer = preg_replace('/namespace\s+[\w\d_\\\\]+;\s?/', '', $classBuffer);
|
498 |
-
$classBuffer = preg_replace_callback('/use\s+([\w\d_\\\\]+)(\s+as\s+.*)?;\s?\n?/', $useExtractor, $classBuffer);
|
499 |
-
|
500 |
-
foreach ($renames as $rename) {
|
501 |
-
$classBuffer = str_replace($rename->from, $rename->to, $classBuffer);
|
502 |
-
}
|
503 |
-
|
504 |
-
$this->body = trim($classBuffer);
|
505 |
-
|
506 |
-
$this->extractHierarchy();
|
507 |
-
}
|
508 |
-
|
509 |
-
private function extractHierarchy()
|
510 |
-
{
|
511 |
-
$implements = array();
|
512 |
-
$extends = array();
|
513 |
-
|
514 |
-
$extractor = function ($iterator, $callback) {
|
515 |
-
$className = '';
|
516 |
-
$iterator->seek($iterator->key() + 1);
|
517 |
-
|
518 |
-
while ($iterator->valid()) {
|
519 |
-
$token = $iterator->current();
|
520 |
-
|
521 |
-
if (is_string($token)) {
|
522 |
-
if (preg_match('/\s?,\s?/', $token)) {
|
523 |
-
$callback(trim($className));
|
524 |
-
$className = '';
|
525 |
-
} else if ($token == '{') {
|
526 |
-
$callback(trim($className));
|
527 |
-
return;
|
528 |
-
}
|
529 |
-
}
|
530 |
-
|
531 |
-
switch ($token[0]) {
|
532 |
-
case T_NS_SEPARATOR:
|
533 |
-
$className .= '\\';
|
534 |
-
break;
|
535 |
-
|
536 |
-
case T_STRING:
|
537 |
-
$className .= $token[1];
|
538 |
-
break;
|
539 |
-
|
540 |
-
case T_IMPLEMENTS:
|
541 |
-
case T_EXTENDS:
|
542 |
-
$callback(trim($className));
|
543 |
-
$iterator->seek($iterator->key() - 1);
|
544 |
-
return;
|
545 |
-
}
|
546 |
-
|
547 |
-
$iterator->next();
|
548 |
-
}
|
549 |
-
};
|
550 |
-
|
551 |
-
$tokens = token_get_all("<?php\n" . trim($this->getPhpCode()));
|
552 |
-
$iterator = new ArrayIterator($tokens);
|
553 |
-
|
554 |
-
while ($iterator->valid()) {
|
555 |
-
$token = $iterator->current();
|
556 |
-
if (is_string($token)) {
|
557 |
-
$iterator->next();
|
558 |
-
continue;
|
559 |
-
}
|
560 |
-
|
561 |
-
switch ($token[0]) {
|
562 |
-
case T_CLASS:
|
563 |
-
case T_INTERFACE:
|
564 |
-
$iterator->seek($iterator->key() + 2);
|
565 |
-
$tk = $iterator->current();
|
566 |
-
$this->name = $tk[1];
|
567 |
-
break;
|
568 |
-
|
569 |
-
case T_IMPLEMENTS:
|
570 |
-
$extractor($iterator, function ($fqn) use (&$implements) {
|
571 |
-
$implements[] = $fqn;
|
572 |
-
});
|
573 |
-
break;
|
574 |
-
|
575 |
-
case T_EXTENDS:
|
576 |
-
$extractor($iterator, function ($fqn) use (&$extends) {
|
577 |
-
$extends[] = $fqn;
|
578 |
-
});
|
579 |
-
break;
|
580 |
-
}
|
581 |
-
|
582 |
-
$iterator->next();
|
583 |
-
}
|
584 |
-
|
585 |
-
$this->implements = $this->guessFQN($implements);
|
586 |
-
$this->extends = $this->guessFQN($extends);
|
587 |
-
}
|
588 |
-
|
589 |
-
public function guessFQN($classes)
|
590 |
-
{
|
591 |
-
$useDirectives = $this->getNamespace()->getUseDirectives();
|
592 |
-
return array_map(array($useDirectives, 'getFQN'), $classes);
|
593 |
-
}
|
594 |
-
|
595 |
-
public function getImplementedInterfaces($all = false)
|
596 |
-
{
|
597 |
-
if ($all) {
|
598 |
-
return $this->implements;
|
599 |
-
}
|
600 |
-
|
601 |
-
return array_filter(
|
602 |
-
$this->implements,
|
603 |
-
function ($cn) { return strpos($cn, 'Predis\\') === 0; }
|
604 |
-
);
|
605 |
-
}
|
606 |
-
|
607 |
-
public function getExtendedClasses($all = false)
|
608 |
-
{
|
609 |
-
if ($all) {
|
610 |
-
return $this->extemds;
|
611 |
-
}
|
612 |
-
|
613 |
-
return array_filter(
|
614 |
-
$this->extends,
|
615 |
-
function ($cn) { return strpos($cn, 'Predis\\') === 0; }
|
616 |
-
);
|
617 |
-
}
|
618 |
-
|
619 |
-
public function getDependencies($all = false)
|
620 |
-
{
|
621 |
-
return array_merge(
|
622 |
-
$this->getImplementedInterfaces($all),
|
623 |
-
$this->getExtendedClasses($all)
|
624 |
-
);
|
625 |
-
}
|
626 |
-
|
627 |
-
public function getNamespace()
|
628 |
-
{
|
629 |
-
return $this->namespace;
|
630 |
-
}
|
631 |
-
|
632 |
-
public function getFile()
|
633 |
-
{
|
634 |
-
return $this->file;
|
635 |
-
}
|
636 |
-
|
637 |
-
public function getName()
|
638 |
-
{
|
639 |
-
return $this->name;
|
640 |
-
}
|
641 |
-
|
642 |
-
public function getFQN()
|
643 |
-
{
|
644 |
-
return (string)$this->getNamespace() . '\\' . $this->name;
|
645 |
-
}
|
646 |
-
|
647 |
-
public function getPhpCode()
|
648 |
-
{
|
649 |
-
return $this->body;
|
650 |
-
}
|
651 |
-
|
652 |
-
public function __toString()
|
653 |
-
{
|
654 |
-
return "class " . $this->getName() . '{ ... }';
|
655 |
-
}
|
656 |
-
}
|
657 |
-
|
658 |
-
/* -------------------------------------------------------------------------- */
|
659 |
-
|
660 |
-
$options = CommandLine::getOptions();
|
661 |
-
$predisFile = PredisFile::from($options['source'], $options['exclude']);
|
662 |
-
$predisFile->saveTo($options['output']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/composer.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"name": "predis/predis",
|
3 |
"type": "library",
|
4 |
-
"description": "
|
5 |
"keywords": ["nosql", "redis", "predis"],
|
6 |
"homepage": "http://github.com/predis/predis",
|
7 |
"license": "MIT",
|
@@ -28,10 +28,10 @@
|
|
28 |
}
|
29 |
],
|
30 |
"require": {
|
31 |
-
"php": "
|
32 |
},
|
33 |
"require-dev": {
|
34 |
-
"phpunit/phpunit": "~4.
|
35 |
},
|
36 |
"suggest": {
|
37 |
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol",
|
@@ -42,7 +42,9 @@
|
|
42 |
"Predis\\": "src/"
|
43 |
}
|
44 |
},
|
45 |
-
"
|
46 |
-
"
|
|
|
|
|
47 |
}
|
48 |
}
|
1 |
{
|
2 |
"name": "predis/predis",
|
3 |
"type": "library",
|
4 |
+
"description": "A flexible and feature-complete Redis client for PHP.",
|
5 |
"keywords": ["nosql", "redis", "predis"],
|
6 |
"homepage": "http://github.com/predis/predis",
|
7 |
"license": "MIT",
|
28 |
}
|
29 |
],
|
30 |
"require": {
|
31 |
+
"php": "^7.2 || ^8.0"
|
32 |
},
|
33 |
"require-dev": {
|
34 |
+
"phpunit/phpunit": "^8.0 || ~9.4.4"
|
35 |
},
|
36 |
"suggest": {
|
37 |
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol",
|
42 |
"Predis\\": "src/"
|
43 |
}
|
44 |
},
|
45 |
+
"extra": {
|
46 |
+
"branch-alias": {
|
47 |
+
"dev-main": "2.0-dev"
|
48 |
+
}
|
49 |
}
|
50 |
}
|
dependencies/predis/predis/examples/custom_cluster_distributor.php
CHANGED
@@ -18,7 +18,7 @@ require __DIR__.'/shared.php';
|
|
18 |
use Predis\Cluster\Distributor\DistributorInterface;
|
19 |
use Predis\Cluster\Hash\HashGeneratorInterface;
|
20 |
use Predis\Cluster\PredisStrategy;
|
21 |
-
use Predis\Connection\
|
22 |
|
23 |
class NaiveDistributor implements DistributorInterface, HashGeneratorInterface
|
24 |
{
|
@@ -104,8 +104,8 @@ for ($i = 0; $i < 100; ++$i) {
|
|
104 |
$client->get("key:$i");
|
105 |
}
|
106 |
|
107 |
-
$server1 = $client->
|
108 |
-
$server2 = $client->
|
109 |
|
110 |
if (isset($server1['Keyspace'], $server2['Keyspace'])) {
|
111 |
$server1 = $server1['Keyspace'];
|
18 |
use Predis\Cluster\Distributor\DistributorInterface;
|
19 |
use Predis\Cluster\Hash\HashGeneratorInterface;
|
20 |
use Predis\Cluster\PredisStrategy;
|
21 |
+
use Predis\Connection\Cluster\PredisCluster;
|
22 |
|
23 |
class NaiveDistributor implements DistributorInterface, HashGeneratorInterface
|
24 |
{
|
104 |
$client->get("key:$i");
|
105 |
}
|
106 |
|
107 |
+
$server1 = $client->getClientBy('alias', 'first')->info();
|
108 |
+
$server2 = $client->getClientBy('alias', 'second')->info();
|
109 |
|
110 |
if (isset($server1['Keyspace'], $server2['Keyspace'])) {
|
111 |
$server1 = $server1['Keyspace'];
|
dependencies/predis/predis/examples/dispatcher_loop.php
CHANGED
@@ -51,7 +51,7 @@ class EventsListener implements Countable
|
|
51 |
return $this->events;
|
52 |
}
|
53 |
|
54 |
-
public function __invoke($payload)
|
55 |
{
|
56 |
$this->events[] = $payload;
|
57 |
}
|
@@ -61,7 +61,7 @@ class EventsListener implements Countable
|
|
61 |
$dispatcher->attachCallback('events', ($events = new EventsListener()));
|
62 |
|
63 |
// Attach a function to control the dispatcher loop termination with a message.
|
64 |
-
$dispatcher->attachCallback('control', function ($payload
|
65 |
if ($payload === 'terminate_dispatcher') {
|
66 |
$dispatcher->stop();
|
67 |
}
|
51 |
return $this->events;
|
52 |
}
|
53 |
|
54 |
+
public function __invoke($payload, $dispatcher)
|
55 |
{
|
56 |
$this->events[] = $payload;
|
57 |
}
|
61 |
$dispatcher->attachCallback('events', ($events = new EventsListener()));
|
62 |
|
63 |
// Attach a function to control the dispatcher loop termination with a message.
|
64 |
+
$dispatcher->attachCallback('control', function ($payload, $dispatcher) {
|
65 |
if ($payload === 'terminate_dispatcher') {
|
66 |
$dispatcher->stop();
|
67 |
}
|
dependencies/predis/predis/examples/lua_scripting_abstraction.php
CHANGED
@@ -13,11 +13,10 @@ require __DIR__.'/shared.php';
|
|
13 |
|
14 |
// This example will not work with versions of Redis < 2.6.
|
15 |
//
|
16 |
-
// Additionally to the EVAL command
|
17 |
-
//
|
18 |
-
//
|
19 |
-
//
|
20 |
-
// INCREX.
|
21 |
|
22 |
use Predis\Command\ScriptCommand;
|
23 |
|
@@ -50,12 +49,9 @@ LUA;
|
|
50 |
}
|
51 |
|
52 |
$client = new Predis\Client($single_server, array(
|
53 |
-
'
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
return $profile;
|
58 |
-
},
|
59 |
));
|
60 |
|
61 |
$client->mset('foo', 10, 'foobar', 100);
|
13 |
|
14 |
// This example will not work with versions of Redis < 2.6.
|
15 |
//
|
16 |
+
// Additionally to the EVAL command, the Predis\Command\ScriptCommand class can
|
17 |
+
// be used to leverage an higher level abstraction for Lua scripting that makes
|
18 |
+
// scripts appear just like any other command on the client-side. This is basic
|
19 |
+
// example on how a script-based INCREX command can be defined:
|
|
|
20 |
|
21 |
use Predis\Command\ScriptCommand;
|
22 |
|
49 |
}
|
50 |
|
51 |
$client = new Predis\Client($single_server, array(
|
52 |
+
'commands' => array(
|
53 |
+
'increxby' => 'IncrementExistingKeysBy',
|
54 |
+
),
|
|
|
|
|
|
|
55 |
));
|
56 |
|
57 |
$client->mset('foo', 10, 'foobar', 100);
|
dependencies/predis/predis/examples/redis_collections_iterators.php
CHANGED
@@ -13,7 +13,7 @@ require __DIR__.'/shared.php';
|
|
13 |
|
14 |
use Predis\Collection\Iterator;
|
15 |
|
16 |
-
// Starting
|
17 |
// without blocking the server like it happens when a command such as KEYS is
|
18 |
// executed on a Redis instance storing millions of keys. These commands are:
|
19 |
//
|
@@ -29,8 +29,7 @@ use Predis\Collection\Iterator;
|
|
29 |
// See http://redis.io/commands/scan for more details.
|
30 |
//
|
31 |
|
32 |
-
|
33 |
-
$client = new Predis\Client($single_server, array('profile' => '2.8'));
|
34 |
|
35 |
// Prepare some keys for our example
|
36 |
$client->del('predis:set', 'predis:zset', 'predis:hash');
|
13 |
|
14 |
use Predis\Collection\Iterator;
|
15 |
|
16 |
+
// Starting with Redis 2.8, clients can iterate incrementally over collections
|
17 |
// without blocking the server like it happens when a command such as KEYS is
|
18 |
// executed on a Redis instance storing millions of keys. These commands are:
|
19 |
//
|
29 |
// See http://redis.io/commands/scan for more details.
|
30 |
//
|
31 |
|
32 |
+
$client = new Predis\Client($single_server);
|
|
|
33 |
|
34 |
// Prepare some keys for our example
|
35 |
$client->del('predis:set', 'predis:zset', 'predis:hash');
|
dependencies/predis/predis/examples/replication_complex.php
CHANGED
@@ -14,12 +14,12 @@ require __DIR__.'/shared.php';
|
|
14 |
// Predis allows to set Lua scripts as read-only operations for replication.
|
15 |
// This works for both EVAL and EVALSHA and also for the client-side abstraction
|
16 |
// built upon them (Predis\Command\ScriptCommand). This example shows a slightly
|
17 |
-
// more complex configuration that injects a new script command in the
|
18 |
-
//
|
19 |
-
//
|
20 |
|
21 |
use Predis\Command\ScriptCommand;
|
22 |
-
use Predis\Connection\
|
23 |
use Predis\Replication\ReplicationStrategy;
|
24 |
|
25 |
// ------------------------------------------------------------------------- //
|
@@ -47,17 +47,14 @@ LUA;
|
|
47 |
// ------------------------------------------------------------------------- //
|
48 |
|
49 |
$parameters = array(
|
50 |
-
'tcp://127.0.0.1:
|
51 |
-
'tcp://127.0.0.1:
|
52 |
);
|
53 |
|
54 |
$options = array(
|
55 |
-
'
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
return $profile;
|
60 |
-
},
|
61 |
'replication' => function () {
|
62 |
$strategy = new ReplicationStrategy();
|
63 |
$strategy->setScriptReadOnly(HashMultipleGetAll::BODY);
|
@@ -79,7 +76,7 @@ $client = new Predis\Client($parameters, $options);
|
|
79 |
$hashes = $client->hmgetall('metavars', 'servers');
|
80 |
|
81 |
$replication = $client->getConnection();
|
82 |
-
$stillOnSlave = $replication->getCurrent() === $replication->
|
83 |
|
84 |
echo 'Is still on slave? ', $stillOnSlave ? 'YES!' : 'NO!', PHP_EOL;
|
85 |
var_export($hashes);
|
14 |
// Predis allows to set Lua scripts as read-only operations for replication.
|
15 |
// This works for both EVAL and EVALSHA and also for the client-side abstraction
|
16 |
// built upon them (Predis\Command\ScriptCommand). This example shows a slightly
|
17 |
+
// more complex configuration that injects a new script command in the command
|
18 |
+
// factory used by the client and marks it as a read-only operation so that it
|
19 |
+
// will be executed on slaves.
|
20 |
|
21 |
use Predis\Command\ScriptCommand;
|
22 |
+
use Predis\Connection\Replication\MasterSlaveReplication;
|
23 |
use Predis\Replication\ReplicationStrategy;
|
24 |
|
25 |
// ------------------------------------------------------------------------- //
|
47 |
// ------------------------------------------------------------------------- //
|
48 |
|
49 |
$parameters = array(
|
50 |
+
'tcp://127.0.0.1:6381?role=master&database=15',
|
51 |
+
'tcp://127.0.0.1:6382?role=slave&alias=slave-01&database=15',
|
52 |
);
|
53 |
|
54 |
$options = array(
|
55 |
+
'commands' => array(
|
56 |
+
'hmgetall' => 'HashMultipleGetAll',
|
57 |
+
),
|
|
|
|
|
|
|
58 |
'replication' => function () {
|
59 |
$strategy = new ReplicationStrategy();
|
60 |
$strategy->setScriptReadOnly(HashMultipleGetAll::BODY);
|
76 |
$hashes = $client->hmgetall('metavars', 'servers');
|
77 |
|
78 |
$replication = $client->getConnection();
|
79 |
+
$stillOnSlave = $replication->getCurrent() === $replication->getConnectionByAlias('slave-01');
|
80 |
|
81 |
echo 'Is still on slave? ', $stillOnSlave ? 'YES!' : 'NO!', PHP_EOL;
|
82 |
var_export($hashes);
|
dependencies/predis/predis/examples/replication_sentinel.php
CHANGED
@@ -39,17 +39,17 @@ $client = new Predis\Client($sentinels, array(
|
|
39 |
// Read operation.
|
40 |
$exists = $client->exists('foo') ? 'yes' : 'no';
|
41 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
42 |
-
echo "Does 'foo' exist on {$current->
|
43 |
|
44 |
// Write operation.
|
45 |
$client->set('foo', 'bar');
|
46 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
47 |
-
echo "Now 'foo' has been set to 'bar' on {$current->
|
48 |
|
49 |
// Read operation.
|
50 |
$bar = $client->get('foo');
|
51 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
52 |
-
echo "We fetched 'foo' from {$current->
|
53 |
|
54 |
/* OUTPUT:
|
55 |
Does 'foo' exist on slave-127.0.0.1:6381? yes.
|
39 |
// Read operation.
|
40 |
$exists = $client->exists('foo') ? 'yes' : 'no';
|
41 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
42 |
+
echo "Does 'foo' exist on {$current->role}? $exists.", PHP_EOL;
|
43 |
|
44 |
// Write operation.
|
45 |
$client->set('foo', 'bar');
|
46 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
47 |
+
echo "Now 'foo' has been set to 'bar' on {$current->role}!", PHP_EOL;
|
48 |
|
49 |
// Read operation.
|
50 |
$bar = $client->get('foo');
|
51 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
52 |
+
echo "We fetched 'foo' from {$current->role} and its value is '$bar'.", PHP_EOL;
|
53 |
|
54 |
/* OUTPUT:
|
55 |
Does 'foo' exist on slave-127.0.0.1:6381? yes.
|
dependencies/predis/predis/examples/replication_simple.php
CHANGED
@@ -22,28 +22,28 @@ require __DIR__.'/shared.php';
|
|
22 |
//
|
23 |
|
24 |
$parameters = array(
|
25 |
-
'tcp://127.0.0.1:
|
26 |
-
'tcp://127.0.0.1:
|
27 |
);
|
28 |
|
29 |
-
$options = array('replication' =>
|
30 |
|
31 |
$client = new Predis\Client($parameters, $options);
|
32 |
|
33 |
// Read operation.
|
34 |
$exists = $client->exists('foo') ? 'yes' : 'no';
|
35 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
36 |
-
echo "Does 'foo' exist on {$current->
|
37 |
|
38 |
// Write operation.
|
39 |
$client->set('foo', 'bar');
|
40 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
41 |
-
echo "Now 'foo' has been set to 'bar' on {$current->
|
42 |
|
43 |
// Read operation.
|
44 |
$bar = $client->get('foo');
|
45 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
46 |
-
echo "We fetched 'foo' from {$current->
|
47 |
|
48 |
/* OUTPUT:
|
49 |
Does 'foo' exist on slave? yes.
|
22 |
//
|
23 |
|
24 |
$parameters = array(
|
25 |
+
'tcp://127.0.0.1:6381?role=master&database=15',
|
26 |
+
'tcp://127.0.0.1:6382?role=slave&database=15',
|
27 |
);
|
28 |
|
29 |
+
$options = array('replication' => 'predis');
|
30 |
|
31 |
$client = new Predis\Client($parameters, $options);
|
32 |
|
33 |
// Read operation.
|
34 |
$exists = $client->exists('foo') ? 'yes' : 'no';
|
35 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
36 |
+
echo "Does 'foo' exist on {$current->role}? $exists.", PHP_EOL;
|
37 |
|
38 |
// Write operation.
|
39 |
$client->set('foo', 'bar');
|
40 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
41 |
+
echo "Now 'foo' has been set to 'bar' on {$current->role}!", PHP_EOL;
|
42 |
|
43 |
// Read operation.
|
44 |
$bar = $client->get('foo');
|
45 |
$current = $client->getConnection()->getCurrent()->getParameters();
|
46 |
+
echo "We fetched 'foo' from {$current->role} and its value is '$bar'.", PHP_EOL;
|
47 |
|
48 |
/* OUTPUT:
|
49 |
Does 'foo' exist on slave? yes.
|
dependencies/predis/predis/package.ini
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
; This file is meant to be used with Onion http://c9s.github.com/Onion/
|
2 |
-
; For instructions on how to build a PEAR package of Predis please follow
|
3 |
-
; the instructions at this URL:
|
4 |
-
;
|
5 |
-
; https://github.com/c9s/Onion#a-quick-tutorial-for-building-pear-package
|
6 |
-
;
|
7 |
-
|
8 |
-
[package]
|
9 |
-
name = "Predis"
|
10 |
-
desc = "Flexible and feature-complete Redis client for PHP and HHVM"
|
11 |
-
homepage = "http://github.com/nrk/predis"
|
12 |
-
license = "MIT"
|
13 |
-
version = "1.1.10"
|
14 |
-
stability = "stable"
|
15 |
-
channel = "pear.nrk.io"
|
16 |
-
|
17 |
-
author = "Daniele Alessandri \"nrk\" <suppakilla@gmail.com>"
|
18 |
-
|
19 |
-
[require]
|
20 |
-
php = ">= 5.3.9"
|
21 |
-
pearinstaller = "1.4.1"
|
22 |
-
|
23 |
-
[roles]
|
24 |
-
*.xml.dist = test
|
25 |
-
*.md = doc
|
26 |
-
LICENSE = doc
|
27 |
-
|
28 |
-
[optional phpiredis]
|
29 |
-
hint = "Add support for faster protocol handling with phpiredis"
|
30 |
-
extensions[] = socket
|
31 |
-
extensions[] = phpiredis
|
32 |
-
|
33 |
-
[optional webdis]
|
34 |
-
hint = "Add support for Webdis"
|
35 |
-
extensions[] = curl
|
36 |
-
extensions[] = phpiredis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Autoloader.php
CHANGED
@@ -16,6 +16,7 @@ namespace Predis;
|
|
16 |
*
|
17 |
* @author Eric Naeseth <eric@thumbtack.com>
|
18 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
|
|
19 |
*/
|
20 |
class Autoloader
|
21 |
{
|
16 |
*
|
17 |
* @author Eric Naeseth <eric@thumbtack.com>
|
18 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
19 |
+
* @codeCoverageIgnore
|
20 |
*/
|
21 |
class Autoloader
|
22 |
{
|
dependencies/predis/predis/src/Client.php
CHANGED
@@ -16,8 +16,8 @@ use Predis\Command\RawCommand;
|
|
16 |
use Predis\Command\ScriptCommand;
|
17 |
use Predis\Configuration\Options;
|
18 |
use Predis\Configuration\OptionsInterface;
|
19 |
-
use Predis\Connection\AggregateConnectionInterface;
|
20 |
use Predis\Connection\ConnectionInterface;
|
|
|
21 |
use Predis\Connection\ParametersInterface;
|
22 |
use Predis\Monitor\Consumer as MonitorConsumer;
|
23 |
use Predis\Pipeline\Pipeline;
|
@@ -40,11 +40,16 @@ use Predis\Transaction\MultiExec as MultiExecTransaction;
|
|
40 |
*/
|
41 |
class Client implements ClientInterface, \IteratorAggregate
|
42 |
{
|
43 |
-
const VERSION = '
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
/**
|
50 |
* @param mixed $parameters Connection parameters for one or more servers.
|
@@ -52,131 +57,101 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
52 |
*/
|
53 |
public function __construct($parameters = null, $options = null)
|
54 |
{
|
55 |
-
$this->options =
|
56 |
-
$this->connection = $this->
|
57 |
-
$this->
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
-
* Creates a new
|
62 |
-
* types of arguments or simply returns the passed argument if it is an
|
63 |
-
* instance of Predis\Configuration\OptionsInterface.
|
64 |
*
|
65 |
-
* @param
|
66 |
*
|
67 |
* @throws \InvalidArgumentException
|
68 |
*
|
69 |
* @return OptionsInterface
|
70 |
*/
|
71 |
-
protected function createOptions($options)
|
72 |
{
|
73 |
if (is_array($options)) {
|
74 |
return new Options($options);
|
75 |
-
}
|
76 |
-
|
77 |
-
if ($options instanceof OptionsInterface) {
|
78 |
return $options;
|
|
|
|
|
79 |
}
|
80 |
-
|
81 |
-
throw new \InvalidArgumentException('Invalid type for client options.');
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
* Creates single or aggregate connections from
|
86 |
-
*
|
87 |
-
*
|
88 |
*
|
89 |
-
*
|
|
|
|
|
|
|
|
|
90 |
*
|
91 |
-
*
|
92 |
-
*
|
93 |
-
* - Array
|
94 |
-
* - String
|
95 |
-
* - Callable
|
96 |
*
|
97 |
-
*
|
|
|
|
|
|
|
|
|
|
|
98 |
*
|
99 |
* @throws \InvalidArgumentException
|
100 |
*
|
101 |
* @return ConnectionInterface
|
102 |
*/
|
103 |
-
protected function createConnection($parameters)
|
104 |
{
|
105 |
if ($parameters instanceof ConnectionInterface) {
|
106 |
return $parameters;
|
107 |
}
|
108 |
|
109 |
if ($parameters instanceof ParametersInterface || is_string($parameters)) {
|
110 |
-
return $
|
111 |
}
|
112 |
|
113 |
if (is_array($parameters)) {
|
114 |
if (!isset($parameters[0])) {
|
115 |
-
return $
|
116 |
-
}
|
117 |
-
|
118 |
-
$options = $
|
119 |
-
|
120 |
-
|
121 |
-
$initializer
|
122 |
-
$connection = $initializer($parameters, $options);
|
123 |
-
} elseif ($options->defined('replication')) {
|
124 |
-
$replication = $options->replication;
|
125 |
-
|
126 |
-
if ($replication instanceof AggregateConnectionInterface) {
|
127 |
-
$connection = $replication;
|
128 |
-
$options->connections->aggregate($connection, $parameters);
|
129 |
-
} else {
|
130 |
-
$initializer = $this->getConnectionInitializerWrapper($replication);
|
131 |
-
$connection = $initializer($parameters, $options);
|
132 |
-
}
|
133 |
} else {
|
134 |
-
|
135 |
-
|
|
|
136 |
}
|
137 |
-
|
138 |
-
return $connection;
|
139 |
}
|
140 |
|
141 |
if (is_callable($parameters)) {
|
142 |
-
$
|
143 |
-
$connection = $initializer($this->options);
|
144 |
-
|
145 |
-
return $connection;
|
146 |
-
}
|
147 |
-
|
148 |
-
throw new \InvalidArgumentException('Invalid type for connection parameters.');
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Wraps a callable to make sure that its returned value represents a valid
|
153 |
-
* connection type.
|
154 |
-
*
|
155 |
-
* @param mixed $callable
|
156 |
-
*
|
157 |
-
* @return \Closure
|
158 |
-
*/
|
159 |
-
protected function getConnectionInitializerWrapper($callable)
|
160 |
-
{
|
161 |
-
return function () use ($callable) {
|
162 |
-
$connection = call_user_func_array($callable, func_get_args());
|
163 |
|
164 |
if (!$connection instanceof ConnectionInterface) {
|
165 |
-
throw new \
|
166 |
-
'The callable connection initializer returned an invalid type.'
|
167 |
-
);
|
168 |
}
|
169 |
|
170 |
return $connection;
|
171 |
-
}
|
|
|
|
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
* {@inheritdoc}
|
176 |
*/
|
177 |
-
public function
|
178 |
{
|
179 |
-
return $this->
|
180 |
}
|
181 |
|
182 |
/**
|
@@ -188,23 +163,53 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
188 |
}
|
189 |
|
190 |
/**
|
191 |
-
* Creates a new client
|
192 |
-
* only when working with an aggregate connection (cluster, replication).
|
193 |
-
* The new client instances uses the same options of the original one.
|
194 |
*
|
195 |
-
*
|
|
|
|
|
196 |
*
|
197 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
*
|
199 |
-
* @
|
|
|
|
|
|
|
200 |
*/
|
201 |
-
public function
|
202 |
{
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
|
207 |
-
return new static($connection, $this->
|
208 |
}
|
209 |
|
210 |
/**
|
@@ -252,27 +257,6 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
252 |
return $this->connection;
|
253 |
}
|
254 |
|
255 |
-
/**
|
256 |
-
* Retrieves the specified connection from the aggregate connection when the
|
257 |
-
* client is in cluster or replication mode.
|
258 |
-
*
|
259 |
-
* @param string $connectionID Index or alias of the single connection.
|
260 |
-
*
|
261 |
-
* @throws NotSupportedException
|
262 |
-
*
|
263 |
-
* @return Connection\NodeConnectionInterface
|
264 |
-
*/
|
265 |
-
public function getConnectionById($connectionID)
|
266 |
-
{
|
267 |
-
if (!$this->connection instanceof AggregateConnectionInterface) {
|
268 |
-
throw new NotSupportedException(
|
269 |
-
'Retrieving connections by ID is supported only by aggregate connections.'
|
270 |
-
);
|
271 |
-
}
|
272 |
-
|
273 |
-
return $this->connection->getConnectionById($connectionID);
|
274 |
-
}
|
275 |
-
|
276 |
/**
|
277 |
* Executes a command without filtering its arguments, parsing the response,
|
278 |
* applying any prefix to keys or throwing exceptions on Redis errors even
|
@@ -289,9 +273,10 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
289 |
public function executeRaw(array $arguments, &$error = null)
|
290 |
{
|
291 |
$error = false;
|
|
|
292 |
|
293 |
$response = $this->connection->executeCommand(
|
294 |
-
new RawCommand($arguments)
|
295 |
);
|
296 |
|
297 |
if ($response instanceof ResponseInterface) {
|
@@ -320,7 +305,7 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
320 |
*/
|
321 |
public function createCommand($commandID, $arguments = array())
|
322 |
{
|
323 |
-
return $this->
|
324 |
}
|
325 |
|
326 |
/**
|
@@ -354,10 +339,7 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
354 |
protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response)
|
355 |
{
|
356 |
if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') {
|
357 |
-
$
|
358 |
-
$eval->setRawArguments($command->getEvalArguments());
|
359 |
-
|
360 |
-
$response = $this->executeCommand($eval);
|
361 |
|
362 |
if (!$response instanceof ResponseInterface) {
|
363 |
$response = $command->parseResponse($response);
|
@@ -400,9 +382,11 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
400 |
|
401 |
return $this->$initializer($arg0, $arg1);
|
402 |
|
|
|
403 |
default:
|
404 |
return $this->$initializer($this, $argv);
|
405 |
}
|
|
|
406 |
}
|
407 |
|
408 |
/**
|
@@ -527,7 +511,7 @@ class Client implements ClientInterface, \IteratorAggregate
|
|
527 |
}
|
528 |
|
529 |
/**
|
530 |
-
* @
|
531 |
*/
|
532 |
#[\ReturnTypeWillChange]
|
533 |
public function getIterator()
|
16 |
use Predis\Command\ScriptCommand;
|
17 |
use Predis\Configuration\Options;
|
18 |
use Predis\Configuration\OptionsInterface;
|
|
|
19 |
use Predis\Connection\ConnectionInterface;
|
20 |
+
use Predis\Connection\Parameters;
|
21 |
use Predis\Connection\ParametersInterface;
|
22 |
use Predis\Monitor\Consumer as MonitorConsumer;
|
23 |
use Predis\Pipeline\Pipeline;
|
40 |
*/
|
41 |
class Client implements ClientInterface, \IteratorAggregate
|
42 |
{
|
43 |
+
const VERSION = '2.0.0';
|
44 |
|
45 |
+
/** @var OptionsInterface */
|
46 |
+
private $options;
|
47 |
+
|
48 |
+
/** @var ConnectionInterface */
|
49 |
+
private $connection;
|
50 |
+
|
51 |
+
/** @var Command\FactoryInterface */
|
52 |
+
private $commands;
|
53 |
|
54 |
/**
|
55 |
* @param mixed $parameters Connection parameters for one or more servers.
|
57 |
*/
|
58 |
public function __construct($parameters = null, $options = null)
|
59 |
{
|
60 |
+
$this->options = static::createOptions($options ?? new Options);
|
61 |
+
$this->connection = static::createConnection($this->options, $parameters ?? new Parameters);
|
62 |
+
$this->commands = $this->options->commands;
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
+
* Creates a new set of client options for the client.
|
|
|
|
|
67 |
*
|
68 |
+
* @param array|OptionsInterface $options Set of client options
|
69 |
*
|
70 |
* @throws \InvalidArgumentException
|
71 |
*
|
72 |
* @return OptionsInterface
|
73 |
*/
|
74 |
+
protected static function createOptions($options)
|
75 |
{
|
76 |
if (is_array($options)) {
|
77 |
return new Options($options);
|
78 |
+
} elseif ($options instanceof OptionsInterface) {
|
|
|
|
|
79 |
return $options;
|
80 |
+
} else {
|
81 |
+
throw new \InvalidArgumentException('Invalid type for client options');
|
82 |
}
|
|
|
|
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
+
* Creates single or aggregate connections from supplied arguments.
|
87 |
+
*
|
88 |
+
* This method accepts the following types to create a connection instance:
|
89 |
*
|
90 |
+
* - Array (dictionary: single connection, indexed: aggregate connections)
|
91 |
+
* - String (URI for a single connection)
|
92 |
+
* - Callable (connection initializer callback)
|
93 |
+
* - Instance of Predis\Connection\ParametersInterface (used as-is)
|
94 |
+
* - Instance of Predis\Connection\ConnectionInterface (returned as-is)
|
95 |
*
|
96 |
+
* When a callable is passed, it receives the original set of client options
|
97 |
+
* and must return an instance of Predis\Connection\ConnectionInterface.
|
|
|
|
|
|
|
98 |
*
|
99 |
+
* Connections are created using the connection factory (in case of single
|
100 |
+
* connections) or a specialized aggregate connection initializer (in case
|
101 |
+
* of cluster and replication) retrieved from the supplied client options.
|
102 |
+
*
|
103 |
+
* @param OptionsInterface $options Client options container
|
104 |
+
* @param mixed $parameters Connection parameters
|
105 |
*
|
106 |
* @throws \InvalidArgumentException
|
107 |
*
|
108 |
* @return ConnectionInterface
|
109 |
*/
|
110 |
+
protected static function createConnection(OptionsInterface $options, $parameters)
|
111 |
{
|
112 |
if ($parameters instanceof ConnectionInterface) {
|
113 |
return $parameters;
|
114 |
}
|
115 |
|
116 |
if ($parameters instanceof ParametersInterface || is_string($parameters)) {
|
117 |
+
return $options->connections->create($parameters);
|
118 |
}
|
119 |
|
120 |
if (is_array($parameters)) {
|
121 |
if (!isset($parameters[0])) {
|
122 |
+
return $options->connections->create($parameters);
|
123 |
+
} elseif ($options->defined('cluster') && $initializer = $options->cluster) {
|
124 |
+
return $initializer($parameters, true);
|
125 |
+
} elseif ($options->defined('replication') && $initializer = $options->replication) {
|
126 |
+
return $initializer($parameters, true);
|
127 |
+
} elseif ($options->defined('aggregate') && $initializer = $options->aggregate) {
|
128 |
+
return $initializer($parameters, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
} else {
|
130 |
+
throw new \InvalidArgumentException(
|
131 |
+
'Array of connection parameters requires `cluster`, `replication` or `aggregate` client option'
|
132 |
+
);
|
133 |
}
|
|
|
|
|
134 |
}
|
135 |
|
136 |
if (is_callable($parameters)) {
|
137 |
+
$connection = call_user_func($parameters, $options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
if (!$connection instanceof ConnectionInterface) {
|
140 |
+
throw new \InvalidArgumentException('Callable parameters must return a valid connection');
|
|
|
|
|
141 |
}
|
142 |
|
143 |
return $connection;
|
144 |
+
}
|
145 |
+
|
146 |
+
throw new \InvalidArgumentException('Invalid type for connection parameters');
|
147 |
}
|
148 |
|
149 |
/**
|
150 |
* {@inheritdoc}
|
151 |
*/
|
152 |
+
public function getCommandFactory()
|
153 |
{
|
154 |
+
return $this->commands;
|
155 |
}
|
156 |
|
157 |
/**
|
163 |
}
|
164 |
|
165 |
/**
|
166 |
+
* Creates a new client using a specific underlying connection.
|
|
|
|
|
167 |
*
|
168 |
+
* This method allows to create a new client instance by picking a specific
|
169 |
+
* connection out of an aggregate one, with the same options of the original
|
170 |
+
* client instance.
|
171 |
*
|
172 |
+
* The specified selector defines which logic to use to look for a suitable
|
173 |
+
* connection by the specified value. Supported selectors are:
|
174 |
+
*
|
175 |
+
* - `id`
|
176 |
+
* - `key`
|
177 |
+
* - `slot`
|
178 |
+
* - `command`
|
179 |
+
* - `alias`
|
180 |
+
* - `role`
|
181 |
+
*
|
182 |
+
* Internally the client relies on duck-typing and follows this convention:
|
183 |
+
*
|
184 |
+
* $selector string => getConnectionBy$selector($value) method
|
185 |
+
*
|
186 |
+
* This means that support for specific selectors may vary depending on the
|
187 |
+
* actual logic implemented by connection classes and there is no interface
|
188 |
+
* binding a connection class to implement any of these.
|
189 |
*
|
190 |
+
* @param string $selector Type of selector.
|
191 |
+
* @param mixed $value Value to be used by the selector.
|
192 |
+
*
|
193 |
+
* @return ClientInterface
|
194 |
*/
|
195 |
+
public function getClientBy($selector, $value)
|
196 |
{
|
197 |
+
$selector = strtolower($selector);
|
198 |
+
|
199 |
+
if (!in_array($selector, array('id', 'key', 'slot', 'role', 'alias', 'command'))) {
|
200 |
+
throw new \InvalidArgumentException("Invalid selector type: `$selector`");
|
201 |
+
}
|
202 |
+
|
203 |
+
if (!method_exists($this->connection, $method = "getConnectionBy$selector")) {
|
204 |
+
$class = get_class($this->connection);
|
205 |
+
throw new \InvalidArgumentException("Selecting connection by $selector is not supported by $class");
|
206 |
+
}
|
207 |
+
|
208 |
+
if (!$connection = $this->connection->$method($value)) {
|
209 |
+
throw new \InvalidArgumentException("Cannot find a connection by $selector matching `$value`");
|
210 |
}
|
211 |
|
212 |
+
return new static($connection, $this->getOptions());
|
213 |
}
|
214 |
|
215 |
/**
|
257 |
return $this->connection;
|
258 |
}
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
/**
|
261 |
* Executes a command without filtering its arguments, parsing the response,
|
262 |
* applying any prefix to keys or throwing exceptions on Redis errors even
|
273 |
public function executeRaw(array $arguments, &$error = null)
|
274 |
{
|
275 |
$error = false;
|
276 |
+
$commandID = array_shift($arguments);
|
277 |
|
278 |
$response = $this->connection->executeCommand(
|
279 |
+
new RawCommand($commandID, $arguments)
|
280 |
);
|
281 |
|
282 |
if ($response instanceof ResponseInterface) {
|
305 |
*/
|
306 |
public function createCommand($commandID, $arguments = array())
|
307 |
{
|
308 |
+
return $this->commands->create($commandID, $arguments);
|
309 |
}
|
310 |
|
311 |
/**
|
339 |
protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response)
|
340 |
{
|
341 |
if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') {
|
342 |
+
$response = $this->executeCommand($command->getEvalCommand());
|
|
|
|
|
|
|
343 |
|
344 |
if (!$response instanceof ResponseInterface) {
|
345 |
$response = $command->parseResponse($response);
|
382 |
|
383 |
return $this->$initializer($arg0, $arg1);
|
384 |
|
385 |
+
// @codeCoverageIgnoreStart
|
386 |
default:
|
387 |
return $this->$initializer($this, $argv);
|
388 |
}
|
389 |
+
// @codeCoverageIgnoreEnd
|
390 |
}
|
391 |
|
392 |
/**
|
511 |
}
|
512 |
|
513 |
/**
|
514 |
+
* {@inheritdoc}
|
515 |
*/
|
516 |
#[\ReturnTypeWillChange]
|
517 |
public function getIterator()
|
dependencies/predis/predis/src/ClientInterface.php
CHANGED
@@ -12,9 +12,10 @@
|
|
12 |
namespace Predis;
|
13 |
|
14 |
use Predis\Command\CommandInterface;
|
|
|
15 |
use Predis\Configuration\OptionsInterface;
|
16 |
use Predis\Connection\ConnectionInterface;
|
17 |
-
use Predis\
|
18 |
|
19 |
/**
|
20 |
* Interface defining a client able to execute commands against Redis.
|
@@ -24,134 +25,137 @@ use Predis\Profile\ProfileInterface;
|
|
24 |
* and more friendly interface to ease programming which is described in the
|
25 |
* following list of methods:
|
26 |
*
|
27 |
-
* @method int del(
|
28 |
-
* @method string|null dump($key)
|
29 |
-
* @method int exists($key)
|
30 |
-
* @method int expire($key, $seconds)
|
31 |
-
* @method int expireat($key, $timestamp)
|
32 |
-
* @method array keys($pattern)
|
33 |
-
* @method int move($key, $db)
|
34 |
-
* @method mixed object($subcommand, $key)
|
35 |
-
* @method int persist($key)
|
36 |
-
* @method int pexpire($key, $milliseconds)
|
37 |
-
* @method int pexpireat($key, $timestamp)
|
38 |
-
* @method int pttl($key)
|
39 |
* @method string|null randomkey()
|
40 |
-
* @method mixed rename($key, $target)
|
41 |
-
* @method int renamenx($key, $target)
|
42 |
* @method array scan($cursor, array $options = null)
|
43 |
-
* @method array sort($key, array $options = null)
|
44 |
-
* @method int ttl($key)
|
45 |
-
* @method mixed type($key)
|
46 |
-
* @method int append($key, $value)
|
47 |
-
* @method int bitcount($key, $start = null, $end = null)
|
48 |
* @method int bitop($operation, $destkey, $key)
|
49 |
-
* @method array|null bitfield($key, $subcommand, ...$subcommandArg)
|
50 |
-
* @method int bitpos($key, $bit, $start = null, $end = null)
|
51 |
-
* @method int decr($key)
|
52 |
-
* @method int decrby($key, $decrement)
|
53 |
-
* @method string|null get($key)
|
54 |
-
* @method int getbit($key, $offset)
|
55 |
-
* @method string getrange($key, $start, $end)
|
56 |
-
* @method string|null getset($key, $value)
|
57 |
-
* @method int incr($key)
|
58 |
-
* @method int incrby($key, $increment)
|
59 |
-
* @method string incrbyfloat($key, $increment)
|
60 |
-
* @method array mget(
|
61 |
* @method mixed mset(array $dictionary)
|
62 |
* @method int msetnx(array $dictionary)
|
63 |
-
* @method
|
64 |
-
* @method
|
65 |
-
* @method int setbit($key, $offset, $value)
|
66 |
-
* @method
|
67 |
-
* @method int setnx($key, $value)
|
68 |
-
* @method int setrange($key, $offset, $value)
|
69 |
-
* @method int strlen($key)
|
70 |
-
* @method int hdel($key, array $fields)
|
71 |
-
* @method int hexists($key, $field)
|
72 |
-
* @method string|null hget($key, $field)
|
73 |
-
* @method array hgetall($key)
|
74 |
-
* @method int hincrby($key, $field, $increment)
|
75 |
-
* @method string hincrbyfloat($key, $field, $increment)
|
76 |
-
* @method array hkeys($key)
|
77 |
-
* @method int hlen($key)
|
78 |
-
* @method array hmget($key, array $fields)
|
79 |
-
* @method mixed hmset($key, array $dictionary)
|
80 |
-
* @method array hscan($key, $cursor, array $options = null)
|
81 |
-
* @method int hset($key, $field, $value)
|
82 |
-
* @method int hsetnx($key, $field, $value)
|
83 |
-
* @method array hvals($key)
|
84 |
-
* @method int hstrlen($key, $field)
|
85 |
-
* @method array|null blpop(array|string $keys, $timeout)
|
86 |
-
* @method array|null brpop(array|string $keys, $timeout)
|
87 |
-
* @method string|null brpoplpush($source, $destination, $timeout)
|
88 |
-
* @method string|null lindex($key, $index)
|
89 |
-
* @method int linsert($key, $whence, $pivot, $value)
|
90 |
-
* @method int llen($key)
|
91 |
-
* @method string|null lpop($key)
|
92 |
-
* @method int lpush($key, array $values)
|
93 |
-
* @method int lpushx($key, array $values)
|
94 |
-
* @method
|
95 |
-
* @method int lrem($key, $count, $value)
|
96 |
-
* @method mixed lset($key, $index, $value)
|
97 |
-
* @method mixed ltrim($key, $start, $stop)
|
98 |
-
* @method string|null rpop($key)
|
99 |
-
* @method string|null rpoplpush($source, $destination)
|
100 |
-
* @method int rpush($key, array $values)
|
101 |
-
* @method int rpushx($key, array $values)
|
102 |
-
* @method int sadd($key, array $members)
|
103 |
-
* @method int scard($key)
|
104 |
-
* @method
|
105 |
-
* @method int sdiffstore($destination, array|string $keys)
|
106 |
-
* @method
|
107 |
-
* @method int sinterstore($destination, array|string $keys)
|
108 |
-
* @method int sismember($key, $member)
|
109 |
-
* @method
|
110 |
-
* @method int smove($source, $destination, $member)
|
111 |
-
* @method string|null spop($key, $count = null)
|
112 |
-
* @method string|null srandmember($key, $count = null)
|
113 |
-
* @method int srem($key, $member)
|
114 |
-
* @method array sscan($key, $cursor, array $options = null)
|
115 |
-
* @method
|
116 |
-
* @method int sunionstore($destination, array|string $keys)
|
117 |
-
* @method int
|
118 |
-
* @method int
|
119 |
-
* @method string
|
120 |
-
* @method string
|
121 |
-
* @method
|
122 |
-
* @method
|
123 |
-
* @method array
|
124 |
-
* @method
|
125 |
-
* @method
|
126 |
-
* @method
|
127 |
-
* @method int
|
128 |
-
* @method
|
129 |
-
* @method
|
130 |
-
* @method int
|
131 |
-
* @method
|
132 |
-
* @method string
|
133 |
-
* @method
|
134 |
-
* @method
|
135 |
-
* @method
|
136 |
-
* @method
|
137 |
-
* @method
|
138 |
-
* @method
|
139 |
-
* @method
|
140 |
-
* @method int
|
|
|
|
|
|
|
141 |
* @method mixed pubsub($subcommand, $argument)
|
142 |
* @method int publish($channel, $message)
|
143 |
* @method mixed discard()
|
144 |
* @method array|null exec()
|
145 |
* @method mixed multi()
|
146 |
* @method mixed unwatch()
|
147 |
-
* @method mixed watch($key)
|
148 |
-
* @method mixed eval($script, $numkeys,
|
149 |
-
* @method mixed evalsha($script, $numkeys,
|
150 |
* @method mixed script($subcommand, $argument = null)
|
151 |
-
* @method mixed auth($password)
|
152 |
-
* @method string echo($message)
|
153 |
-
* @method mixed ping($message = null)
|
154 |
-
* @method mixed select($database)
|
155 |
* @method mixed bgrewriteaof()
|
156 |
* @method mixed bgsave()
|
157 |
* @method mixed client($subcommand, $argument = null)
|
@@ -162,27 +166,27 @@ use Predis\Profile\ProfileInterface;
|
|
162 |
* @method array info($section = null)
|
163 |
* @method int lastsave()
|
164 |
* @method mixed save()
|
165 |
-
* @method mixed slaveof($host, $port)
|
166 |
* @method mixed slowlog($subcommand, $argument = null)
|
167 |
* @method array time()
|
168 |
* @method array command()
|
169 |
-
* @method int geoadd($key, $longitude, $latitude, $member)
|
170 |
-
* @method array geohash($key, array $members)
|
171 |
-
* @method array geopos($key, array $members)
|
172 |
-
* @method string|null geodist($key, $member1, $member2, $unit = null)
|
173 |
-
* @method array georadius($key, $longitude, $latitude, $radius, $unit, array $options = null)
|
174 |
-
* @method array georadiusbymember($key, $member, $radius, $unit, array $options = null)
|
175 |
*
|
176 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
177 |
*/
|
178 |
interface ClientInterface
|
179 |
{
|
180 |
/**
|
181 |
-
* Returns the
|
182 |
*
|
183 |
-
* @return
|
184 |
*/
|
185 |
-
public function
|
186 |
|
187 |
/**
|
188 |
* Returns the client options specified upon initialization.
|
12 |
namespace Predis;
|
13 |
|
14 |
use Predis\Command\CommandInterface;
|
15 |
+
use Predis\Command\FactoryInterface;
|
16 |
use Predis\Configuration\OptionsInterface;
|
17 |
use Predis\Connection\ConnectionInterface;
|
18 |
+
use Predis\Response\Status;
|
19 |
|
20 |
/**
|
21 |
* Interface defining a client able to execute commands against Redis.
|
25 |
* and more friendly interface to ease programming which is described in the
|
26 |
* following list of methods:
|
27 |
*
|
28 |
+
* @method int del(string[]|string $keyOrKeys, string ...$keys = null)
|
29 |
+
* @method string|null dump(string $key)
|
30 |
+
* @method int exists(string $key)
|
31 |
+
* @method int expire(string $key, int $seconds)
|
32 |
+
* @method int expireat(string $key, int $timestamp)
|
33 |
+
* @method array keys(string $pattern)
|
34 |
+
* @method int move(string $key, int $db)
|
35 |
+
* @method mixed object($subcommand, string $key)
|
36 |
+
* @method int persist(string $key)
|
37 |
+
* @method int pexpire(string $key, int $milliseconds)
|
38 |
+
* @method int pexpireat(string $key, int $timestamp)
|
39 |
+
* @method int pttl(string $key)
|
40 |
* @method string|null randomkey()
|
41 |
+
* @method mixed rename(string $key, string $target)
|
42 |
+
* @method int renamenx(string $key, string $target)
|
43 |
* @method array scan($cursor, array $options = null)
|
44 |
+
* @method array sort(string $key, array $options = null)
|
45 |
+
* @method int ttl(string $key)
|
46 |
+
* @method mixed type(string $key)
|
47 |
+
* @method int append(string $key, $value)
|
48 |
+
* @method int bitcount(string $key, $start = null, $end = null)
|
49 |
* @method int bitop($operation, $destkey, $key)
|
50 |
+
* @method array|null bitfield(string $key, $subcommand, ...$subcommandArg)
|
51 |
+
* @method int bitpos(string $key, $bit, $start = null, $end = null)
|
52 |
+
* @method int decr(string $key)
|
53 |
+
* @method int decrby(string $key, int $decrement)
|
54 |
+
* @method string|null get(string $key)
|
55 |
+
* @method int getbit(string $key, $offset)
|
56 |
+
* @method string getrange(string $key, $start, $end)
|
57 |
+
* @method string|null getset(string $key, $value)
|
58 |
+
* @method int incr(string $key)
|
59 |
+
* @method int incrby(string $key, int $increment)
|
60 |
+
* @method string incrbyfloat(string $key, int|float $increment)
|
61 |
+
* @method array mget(string[]|string $keyOrKeys, string ...$keys = null)
|
62 |
* @method mixed mset(array $dictionary)
|
63 |
* @method int msetnx(array $dictionary)
|
64 |
+
* @method Status psetex(string $key, $milliseconds, $value)
|
65 |
+
* @method Status set(string $key, $value, $expireResolution = null, $expireTTL = null, $flag = null)
|
66 |
+
* @method int setbit(string $key, $offset, $value)
|
67 |
+
* @method Status setex(string $key, $seconds, $value)
|
68 |
+
* @method int setnx(string $key, $value)
|
69 |
+
* @method int setrange(string $key, $offset, $value)
|
70 |
+
* @method int strlen(string $key)
|
71 |
+
* @method int hdel(string $key, array $fields)
|
72 |
+
* @method int hexists(string $key, string $field)
|
73 |
+
* @method string|null hget(string $key, string $field)
|
74 |
+
* @method array hgetall(string $key)
|
75 |
+
* @method int hincrby(string $key, string $field, int $increment)
|
76 |
+
* @method string hincrbyfloat(string $key, string $field, int|float $increment)
|
77 |
+
* @method array hkeys(string $key)
|
78 |
+
* @method int hlen(string $key)
|
79 |
+
* @method array hmget(string $key, array $fields)
|
80 |
+
* @method mixed hmset(string $key, array $dictionary)
|
81 |
+
* @method array hscan(string $key, $cursor, array $options = null)
|
82 |
+
* @method int hset(string $key, string $field, string $value)
|
83 |
+
* @method int hsetnx(string $key, string $field, string $value)
|
84 |
+
* @method array hvals(string $key)
|
85 |
+
* @method int hstrlen(string $key, string $field)
|
86 |
+
* @method array|null blpop(array|string $keys, int|float $timeout)
|
87 |
+
* @method array|null brpop(array|string $keys, int|float $timeout)
|
88 |
+
* @method string|null brpoplpush(string $source, string $destination, int|float $timeout)
|
89 |
+
* @method string|null lindex(string $key, int $index)
|
90 |
+
* @method int linsert(string $key, $whence, $pivot, $value)
|
91 |
+
* @method int llen(string $key)
|
92 |
+
* @method string|null lpop(string $key)
|
93 |
+
* @method int lpush(string $key, array $values)
|
94 |
+
* @method int lpushx(string $key, array $values)
|
95 |
+
* @method string[] lrange(string $key, int $start, int $stop)
|
96 |
+
* @method int lrem(string $key, int $count, string $value)
|
97 |
+
* @method mixed lset(string $key, int $index, string $value)
|
98 |
+
* @method mixed ltrim(string $key, int $start, int $stop)
|
99 |
+
* @method string|null rpop(string $key)
|
100 |
+
* @method string|null rpoplpush(string $source, string $destination)
|
101 |
+
* @method int rpush(string $key, array $values)
|
102 |
+
* @method int rpushx(string $key, array $values)
|
103 |
+
* @method int sadd(string $key, array $members)
|
104 |
+
* @method int scard(string $key)
|
105 |
+
* @method string[] sdiff(array|string $keys)
|
106 |
+
* @method int sdiffstore(string $destination, array|string $keys)
|
107 |
+
* @method string[] sinter(array|string $keys)
|
108 |
+
* @method int sinterstore(string $destination, array|string $keys)
|
109 |
+
* @method int sismember(string $key, string $member)
|
110 |
+
* @method string[] smembers(string $key)
|
111 |
+
* @method int smove(string $source, string $destination, string $member)
|
112 |
+
* @method string|null spop(string $key, int $count = null)
|
113 |
+
* @method string|null srandmember(string $key, int $count = null)
|
114 |
+
* @method int srem(string $key, string $member)
|
115 |
+
* @method array sscan(string $key, int $cursor, array $options = null)
|
116 |
+
* @method string[] sunion(array|string $keys)
|
117 |
+
* @method int sunionstore(string $destination, array|string $keys)
|
118 |
+
* @method int touch(string[]|string $keyOrKeys, string ...$keys = null)
|
119 |
+
* @method int zadd(string $key, array $membersAndScoresDictionary)
|
120 |
+
* @method int zcard(string $key)
|
121 |
+
* @method string zcount(string $key, int|string $min, int|string $max)
|
122 |
+
* @method string zincrby(string $key, int $increment, string $member)
|
123 |
+
* @method int zinterstore(string $destination, array|string $keys, array $options = null)
|
124 |
+
* @method array zpopmin(string $key, int $count = 1)
|
125 |
+
* @method array zpopmax(string $key, int $count = 1)
|
126 |
+
* @method array zrange(string $key, int|string $start, int|string $stop, array $options = null)
|
127 |
+
* @method array zrangebyscore(string $key, int|string $min, int|string $max, array $options = null)
|
128 |
+
* @method int|null zrank(string $key, string $member)
|
129 |
+
* @method int zrem(string $key, string ...$member)
|
130 |
+
* @method int zremrangebyrank(string $key, int|string $start, int|string $stop)
|
131 |
+
* @method int zremrangebyscore(string $key, int|string $min, int|string $max)
|
132 |
+
* @method array zrevrange(string $key, int|string $start, int|string $stop, array $options = null)
|
133 |
+
* @method array zrevrangebyscore(string $key, int|string $max, int|string $min, array $options = null)
|
134 |
+
* @method int|null zrevrank(string $key, string $member)
|
135 |
+
* @method int zunionstore(string $destination, array|string $keys, array $options = null)
|
136 |
+
* @method string|null zscore(string $key, string $member)
|
137 |
+
* @method array zscan(string $key, int $cursor, array $options = null)
|
138 |
+
* @method array zrangebylex(string $key, string $start, string $stop, array $options = null)
|
139 |
+
* @method array zrevrangebylex(string $key, string $start, string $stop, array $options = null)
|
140 |
+
* @method int zremrangebylex(string $key, string $min, string $max)
|
141 |
+
* @method int zlexcount(string $key, string $min, string $max)
|
142 |
+
* @method int pfadd(string $key, array $elements)
|
143 |
+
* @method mixed pfmerge(string $destinationKey, array|string $sourceKeys)
|
144 |
+
* @method int pfcount(string[]|string $keyOrKeys, string ...$keys = null)
|
145 |
* @method mixed pubsub($subcommand, $argument)
|
146 |
* @method int publish($channel, $message)
|
147 |
* @method mixed discard()
|
148 |
* @method array|null exec()
|
149 |
* @method mixed multi()
|
150 |
* @method mixed unwatch()
|
151 |
+
* @method mixed watch(string $key)
|
152 |
+
* @method mixed eval(string $script, int $numkeys, string ...$keyOrArg = null)
|
153 |
+
* @method mixed evalsha(string $script, int $numkeys, string ...$keyOrArg = null)
|
154 |
* @method mixed script($subcommand, $argument = null)
|
155 |
+
* @method mixed auth(string $password)
|
156 |
+
* @method string echo(string $message)
|
157 |
+
* @method mixed ping(string $message = null)
|
158 |
+
* @method mixed select(int $database)
|
159 |
* @method mixed bgrewriteaof()
|
160 |
* @method mixed bgsave()
|
161 |
* @method mixed client($subcommand, $argument = null)
|
166 |
* @method array info($section = null)
|
167 |
* @method int lastsave()
|
168 |
* @method mixed save()
|
169 |
+
* @method mixed slaveof(string $host, int $port)
|
170 |
* @method mixed slowlog($subcommand, $argument = null)
|
171 |
* @method array time()
|
172 |
* @method array command()
|
173 |
+
* @method int geoadd(string $key, $longitude, $latitude, $member)
|
174 |
+
* @method array geohash(string $key, array $members)
|
175 |
+
* @method array geopos(string $key, array $members)
|
176 |
+
* @method string|null geodist(string $key, $member1, $member2, $unit = null)
|
177 |
+
* @method array georadius(string $key, $longitude, $latitude, $radius, $unit, array $options = null)
|
178 |
+
* @method array georadiusbymember(string $key, $member, $radius, $unit, array $options = null)
|
179 |
*
|
180 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
181 |
*/
|
182 |
interface ClientInterface
|
183 |
{
|
184 |
/**
|
185 |
+
* Returns the command factory used by the client.
|
186 |
*
|
187 |
+
* @return FactoryInterface
|
188 |
*/
|
189 |
+
public function getCommandFactory();
|
190 |
|
191 |
/**
|
192 |
* Returns the client options specified upon initialization.
|
dependencies/predis/predis/src/Cluster/Distributor/HashRing.php
CHANGED
@@ -239,9 +239,8 @@ class HashRing implements DistributorInterface, HashGeneratorInterface
|
|
239 |
public function get($value)
|
240 |
{
|
241 |
$hash = $this->hash($value);
|
242 |
-
$node = $this->getByHash($hash);
|
243 |
|
244 |
-
return $
|
245 |
}
|
246 |
|
247 |
/**
|
239 |
public function get($value)
|
240 |
{
|
241 |
$hash = $this->hash($value);
|
|
|
242 |
|
243 |
+
return $this->getByHash($hash);
|
244 |
}
|
245 |
|
246 |
/**
|
dependencies/predis/predis/src/Cluster/Hash/PhpiredisCRC16.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Cluster\Hash;
|
13 |
+
|
14 |
+
use Predis\NotSupportedException;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Hash generator implementing the CRC-CCITT-16 algorithm used by redis-cluster.
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class PhpiredisCRC16 implements HashGeneratorInterface
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
if (!function_exists('phpiredis_utils_crc16')) {
|
29 |
+
// @codeCoverageIgnoreStart
|
30 |
+
throw new NotSupportedException(
|
31 |
+
'This hash generator requires a compatible version of ext-phpiredis'
|
32 |
+
);
|
33 |
+
// @codeCoverageIgnoreEnd
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* {@inheritdoc}
|
39 |
+
*/
|
40 |
+
public function hash($value)
|
41 |
+
{
|
42 |
+
return phpiredis_utils_crc16($value);
|
43 |
+
}
|
44 |
+
}
|
dependencies/predis/predis/src/Cluster/PredisStrategy.php
CHANGED
@@ -40,9 +40,8 @@ class PredisStrategy extends ClusterStrategy
|
|
40 |
{
|
41 |
$key = $this->extractKeyTag($key);
|
42 |
$hash = $this->distributor->hash($key);
|
43 |
-
$slot = $this->distributor->getSlot($hash);
|
44 |
|
45 |
-
return $
|
46 |
}
|
47 |
|
48 |
/**
|
40 |
{
|
41 |
$key = $this->extractKeyTag($key);
|
42 |
$hash = $this->distributor->hash($key);
|
|
|
43 |
|
44 |
+
return $this->distributor->getSlot($hash);
|
45 |
}
|
46 |
|
47 |
/**
|
dependencies/predis/predis/src/Cluster/RedisStrategy.php
CHANGED
@@ -41,9 +41,8 @@ class RedisStrategy extends ClusterStrategy
|
|
41 |
public function getSlotByKey($key)
|
42 |
{
|
43 |
$key = $this->extractKeyTag($key);
|
44 |
-
$slot = $this->hashGenerator->hash($key) & 0x3FFF;
|
45 |
|
46 |
-
return $
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -51,8 +50,7 @@ class RedisStrategy extends ClusterStrategy
|
|
51 |
*/
|
52 |
public function getDistributor()
|
53 |
{
|
54 |
-
|
55 |
-
|
56 |
-
);
|
57 |
}
|
58 |
}
|
41 |
public function getSlotByKey($key)
|
42 |
{
|
43 |
$key = $this->extractKeyTag($key);
|
|
|
44 |
|
45 |
+
return $this->hashGenerator->hash($key) & 0x3FFF;
|
46 |
}
|
47 |
|
48 |
/**
|
50 |
*/
|
51 |
public function getDistributor()
|
52 |
{
|
53 |
+
$class = get_class($this);
|
54 |
+
throw new NotSupportedException("$class does not provide an external distributor");
|
|
|
55 |
}
|
56 |
}
|
dependencies/predis/predis/src/Cluster/SlotMap.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Cluster;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Slot map for redis-cluster.
|
16 |
+
*/
|
17 |
+
class SlotMap implements \ArrayAccess, \IteratorAggregate, \Countable
|
18 |
+
{
|
19 |
+
private $slots = array();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Checks if the given slot is valid.
|
23 |
+
*
|
24 |
+
* @param int $first Slot index.
|
25 |
+
*
|
26 |
+
* @return bool
|
27 |
+
*/
|
28 |
+
public static function isValid($slot)
|
29 |
+
{
|
30 |
+
return $slot >= 0x0000 && $slot <= 0x3FFF;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Checks if the given slot range is valid.
|
35 |
+
*
|
36 |
+
* @param int $first Initial slot of the range.
|
37 |
+
* @param int $last Last slot of the range.
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public static function isValidRange($first, $last)
|
42 |
+
{
|
43 |
+
return $first >= 0x0000 && $first <= 0x3FFF && $last >= 0x0000 && $last <= 0x3FFF && $first <= $last;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Resets the slot map.
|
48 |
+
*/
|
49 |
+
public function reset()
|
50 |
+
{
|
51 |
+
$this->slots = array();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Checks if the slot map is empty.
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
*/
|
59 |
+
public function isEmpty()
|
60 |
+
{
|
61 |
+
return empty($this->slots);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns the current slot map as a dictionary of $slot => $node.
|
66 |
+
*
|
67 |
+
* The order of the slots in the dictionary is not guaranteed.
|
68 |
+
*
|
69 |
+
* @return array
|
70 |
+
*/
|
71 |
+
public function toArray()
|
72 |
+
{
|
73 |
+
return $this->slots;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns the list of unique nodes in the slot map.
|
78 |
+
*
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
+
public function getNodes()
|
82 |
+
{
|
83 |
+
return array_keys(array_flip($this->slots));
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Assigns the specified slot range to a node.
|
88 |
+
*
|
89 |
+
* @param int $first Initial slot of the range.
|
90 |
+
* @param int $last Last slot of the range.
|
91 |
+
* @param NodeConnectionInterface|string $connection ID or connection instance.
|
92 |
+
*
|
93 |
+
* @throws \OutOfBoundsException
|
94 |
+
*/
|
95 |
+
public function setSlots($first, $last, $connection)
|
96 |
+
{
|
97 |
+
if (!static::isValidRange($first, $last)) {
|
98 |
+
throw new \OutOfBoundsException("Invalid slot range $first-$last for `$connection`");
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->slots += array_fill($first, $last - $first + 1, (string) $connection);
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Returns the specified slot range.
|
106 |
+
*
|
107 |
+
* @param int $first Initial slot of the range.
|
108 |
+
* @param int $last Last slot of the range.
|
109 |
+
*
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
public function getSlots($first, $last)
|
113 |
+
{
|
114 |
+
if (!static::isValidRange($first, $last)) {
|
115 |
+
throw new \OutOfBoundsException("Invalid slot range $first-$last");
|
116 |
+
}
|
117 |
+
|
118 |
+
return array_intersect_key($this->slots, array_fill($first, $last - $first + 1, null));
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Checks if the specified slot is assigned.
|
123 |
+
*
|
124 |
+
* @param int $slot Slot index.
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
#[\ReturnTypeWillChange]
|
129 |
+
public function offsetExists($slot)
|
130 |
+
{
|
131 |
+
return isset($this->slots[$slot]);
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Returns the node assigned to the specified slot.
|
136 |
+
*
|
137 |
+
* @param int $slot Slot index.
|
138 |
+
*
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
#[\ReturnTypeWillChange]
|
142 |
+
public function offsetGet($slot)
|
143 |
+
{
|
144 |
+
if (isset($this->slots[$slot])) {
|
145 |
+
return $this->slots[$slot];
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Assigns the specified slot to a node.
|
151 |
+
*
|
152 |
+
* @param int $slot Slot index.
|
153 |
+
* @param NodeConnectionInterface|string $connection ID or connection instance.
|
154 |
+
*
|
155 |
+
* @return string
|
156 |
+
*/
|
157 |
+
#[\ReturnTypeWillChange]
|
158 |
+
public function offsetSet($slot, $connection)
|
159 |
+
{
|
160 |
+
if (!static::isValid($slot)) {
|
161 |
+
throw new \OutOfBoundsException("Invalid slot $slot for `$connection`");
|
162 |
+
}
|
163 |
+
|
164 |
+
$this->slots[(int) $slot] = (string) $connection;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Returns the node assigned to the specified slot.
|
169 |
+
*
|
170 |
+
* @param int $slot Slot index.
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
#[\ReturnTypeWillChange]
|
175 |
+
public function offsetUnset($slot)
|
176 |
+
{
|
177 |
+
unset($this->slots[$slot]);
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Returns the current number of assigned slots.
|
182 |
+
*
|
183 |
+
* @return int
|
184 |
+
*/
|
185 |
+
#[\ReturnTypeWillChange]
|
186 |
+
public function count()
|
187 |
+
{
|
188 |
+
return count($this->slots);
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Returns an iterator over the slot map.
|
193 |
+
*
|
194 |
+
* @return \ArrayIterator
|
195 |
+
*/
|
196 |
+
#[\ReturnTypeWillChange]
|
197 |
+
public function getIterator()
|
198 |
+
{
|
199 |
+
return new \ArrayIterator($this->slots);
|
200 |
+
}
|
201 |
+
}
|
dependencies/predis/predis/src/Collection/Iterator/CursorBasedIterator.php
CHANGED
@@ -65,8 +65,8 @@ abstract class CursorBasedIterator implements \Iterator
|
|
65 |
*/
|
66 |
protected function requiredCommand(ClientInterface $client, $commandID)
|
67 |
{
|
68 |
-
if (!$client->
|
69 |
-
throw new NotSupportedException("
|
70 |
}
|
71 |
}
|
72 |
|
65 |
*/
|
66 |
protected function requiredCommand(ClientInterface $client, $commandID)
|
67 |
{
|
68 |
+
if (!$client->getCommandFactory()->supports($commandID)) {
|
69 |
+
throw new NotSupportedException("'$commandID' is not supported by the current command factory.");
|
70 |
}
|
71 |
}
|
72 |
|
dependencies/predis/predis/src/Collection/Iterator/ListKey.php
CHANGED
@@ -73,8 +73,8 @@ class ListKey implements \Iterator
|
|
73 |
*/
|
74 |
protected function requiredCommand(ClientInterface $client, $commandID)
|
75 |
{
|
76 |
-
if (!$client->
|
77 |
-
throw new NotSupportedException("
|
78 |
}
|
79 |
}
|
80 |
|
73 |
*/
|
74 |
protected function requiredCommand(ClientInterface $client, $commandID)
|
75 |
{
|
76 |
+
if (!$client->getCommandFactory()->supports($commandID)) {
|
77 |
+
throw new NotSupportedException("'$commandID' is not supported by the current command factory.");
|
78 |
}
|
79 |
}
|
80 |
|
dependencies/predis/predis/src/Command/Command.php
CHANGED
@@ -21,24 +21,12 @@ abstract class Command implements CommandInterface
|
|
21 |
private $slot;
|
22 |
private $arguments = array();
|
23 |
|
24 |
-
/**
|
25 |
-
* Returns a filtered array of the arguments.
|
26 |
-
*
|
27 |
-
* @param array $arguments List of arguments.
|
28 |
-
*
|
29 |
-
* @return array
|
30 |
-
*/
|
31 |
-
protected function filterArguments(array $arguments)
|
32 |
-
{
|
33 |
-
return $arguments;
|
34 |
-
}
|
35 |
-
|
36 |
/**
|
37 |
* {@inheritdoc}
|
38 |
*/
|
39 |
public function setArguments(array $arguments)
|
40 |
{
|
41 |
-
$this->arguments = $
|
42 |
unset($this->slot);
|
43 |
}
|
44 |
|
21 |
private $slot;
|
22 |
private $arguments = array();
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/**
|
25 |
* {@inheritdoc}
|
26 |
*/
|
27 |
public function setArguments(array $arguments)
|
28 |
{
|
29 |
+
$this->arguments = $arguments;
|
30 |
unset($this->slot);
|
31 |
}
|
32 |
|
dependencies/predis/predis/src/Command/CommandInterface.php
CHANGED
@@ -73,7 +73,7 @@ interface CommandInterface
|
|
73 |
/**
|
74 |
* Parses a raw response and returns a PHP object.
|
75 |
*
|
76 |
-
* @param string $data Binary string containing the whole response.
|
77 |
*
|
78 |
* @return mixed
|
79 |
*/
|
73 |
/**
|
74 |
* Parses a raw response and returns a PHP object.
|
75 |
*
|
76 |
+
* @param string|array|null $data Binary string containing the whole response.
|
77 |
*
|
78 |
* @return mixed
|
79 |
*/
|
dependencies/predis/predis/src/Command/Factory.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command;
|
13 |
+
|
14 |
+
use Predis\ClientException;
|
15 |
+
use Predis\Command\Processor\ProcessorInterface;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Base command factory class.
|
19 |
+
*
|
20 |
+
* This class provides all of the common functionalities required for a command
|
21 |
+
* factory to create new instances of Redis commands objects. It also allows to
|
22 |
+
* define or undefine command handler classes for each command ID.
|
23 |
+
*
|
24 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
25 |
+
*/
|
26 |
+
abstract class Factory implements FactoryInterface
|
27 |
+
{
|
28 |
+
protected $commands = [];
|
29 |
+
protected $processor;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function supports(string ...$commandIDs): bool
|
35 |
+
{
|
36 |
+
foreach ($commandIDs as $commandID) {
|
37 |
+
if ($this->getCommandClass($commandID) === null) {
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Returns the FQCN of a class that represents the specified command ID.
|
47 |
+
*
|
48 |
+
* @codeCoverageIgnore
|
49 |
+
*
|
50 |
+
* @param string $commandID Command ID
|
51 |
+
*
|
52 |
+
* @return ?string
|
53 |
+
*/
|
54 |
+
public function getCommandClass(string $commandID): ?string
|
55 |
+
{
|
56 |
+
if (isset($this->commands[$commandID = strtoupper($commandID)])) {
|
57 |
+
return $this->commands[$commandID];
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* {@inheritdoc}
|
63 |
+
*/
|
64 |
+
public function create(string $commandID, array $arguments = []): CommandInterface
|
65 |
+
{
|
66 |
+
if (!$commandClass = $this->getCommandClass($commandID)) {
|
67 |
+
$commandID = strtoupper($commandID);
|
68 |
+
|
69 |
+
throw new ClientException("Command `$commandID` is not a registered Redis command.");
|
70 |
+
}
|
71 |
+
|
72 |
+
$command = new $commandClass();
|
73 |
+
$command->setArguments($arguments);
|
74 |
+
|
75 |
+
if (isset($this->processor)) {
|
76 |
+
$this->processor->process($command);
|
77 |
+
}
|
78 |
+
|
79 |
+
return $command;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Defines a command in the factory.
|
84 |
+
*
|
85 |
+
* Only classes implementing Predis\Command\CommandInterface are allowed to
|
86 |
+
* handle a command. If the command specified by its ID is already handled
|
87 |
+
* by the factory, the underlying command class is replaced by the new one.
|
88 |
+
*
|
89 |
+
* @param string $commandID Command ID
|
90 |
+
* @param string $commandClass FQCN of a class implementing Predis\Command\CommandInterface
|
91 |
+
*
|
92 |
+
* @throws \InvalidArgumentException
|
93 |
+
*/
|
94 |
+
public function define(string $commandID, string $commandClass): void
|
95 |
+
{
|
96 |
+
if (!is_a($commandClass, 'Predis\Command\CommandInterface', true)) {
|
97 |
+
throw new \InvalidArgumentException(
|
98 |
+
"Class $commandClass must implement Predis\Command\CommandInterface"
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->commands[strtoupper($commandID)] = $commandClass;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Undefines a command in the factory.
|
107 |
+
*
|
108 |
+
* When the factory already has a class handler associated to the specified
|
109 |
+
* command ID it is removed from the map of known commands. Nothing happens
|
110 |
+
* when the command is not handled by the factory.
|
111 |
+
*
|
112 |
+
* @param string $commandID Command ID
|
113 |
+
*/
|
114 |
+
public function undefine(string $commandID): void
|
115 |
+
{
|
116 |
+
unset($this->commands[strtoupper($commandID)]);
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Sets a command processor for processing command arguments.
|
121 |
+
*
|
122 |
+
* Command processors are used to process and transform arguments of Redis
|
123 |
+
* commands before their newly created instances are returned to the caller
|
124 |
+
* of "create()".
|
125 |
+
*
|
126 |
+
* A NULL value can be used to effectively unset any processor if previously
|
127 |
+
* set for the command factory.
|
128 |
+
*
|
129 |
+
* @param ProcessorInterface|null $processor Command processor or NULL value.
|
130 |
+
*/
|
131 |
+
public function setProcessor(?ProcessorInterface $processor): void
|
132 |
+
{
|
133 |
+
$this->processor = $processor;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Returns the current command processor.
|
138 |
+
*
|
139 |
+
* @return ?ProcessorInterface
|
140 |
+
*/
|
141 |
+
public function getProcessor(): ?ProcessorInterface
|
142 |
+
{
|
143 |
+
return $this->processor;
|
144 |
+
}
|
145 |
+
}
|
dependencies/predis/predis/src/Command/FactoryInterface.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Command factory interface.
|
16 |
+
*
|
17 |
+
* A command factory is used through the library to create instances of commands
|
18 |
+
* classes implementing Predis\Command\CommandInterface mapped to Redis commands
|
19 |
+
* by their command ID string (SET, GET, etc...).
|
20 |
+
*
|
21 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
+
*/
|
23 |
+
interface FactoryInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks if the command factory supports the specified list of commands.
|
27 |
+
*
|
28 |
+
* @param array $commandIDs List of command IDs
|
29 |
+
*
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
public function supports(string ...$commandIDs): bool;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Creates a new command instance.
|
36 |
+
*
|
37 |
+
* @param string $commandID Command ID
|
38 |
+
* @param array $arguments Arguments for the command
|
39 |
+
*
|
40 |
+
* @return CommandInterface
|
41 |
+
*/
|
42 |
+
public function create(string $commandID, array $arguments = array()): CommandInterface;
|
43 |
+
}
|
dependencies/predis/predis/src/Command/Processor/ProcessorChain.php
CHANGED
@@ -89,7 +89,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
|
89 |
}
|
90 |
|
91 |
/**
|
92 |
-
* @
|
93 |
*/
|
94 |
#[\ReturnTypeWillChange]
|
95 |
public function offsetExists($index)
|
@@ -114,8 +114,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
|
114 |
{
|
115 |
if (!$processor instanceof ProcessorInterface) {
|
116 |
throw new \InvalidArgumentException(
|
117 |
-
'
|
118 |
-
"'Predis\Command\Processor\ProcessorInterface'."
|
119 |
);
|
120 |
}
|
121 |
|
89 |
}
|
90 |
|
91 |
/**
|
92 |
+
* {@inheritdoc}
|
93 |
*/
|
94 |
#[\ReturnTypeWillChange]
|
95 |
public function offsetExists($index)
|
114 |
{
|
115 |
if (!$processor instanceof ProcessorInterface) {
|
116 |
throw new \InvalidArgumentException(
|
117 |
+
'Processor chain accepts only instances of `Predis\Command\Processor\ProcessorInterface`'
|
|
|
118 |
);
|
119 |
}
|
120 |
|
dependencies/predis/predis/src/Command/RawCommand.php
CHANGED
@@ -12,52 +12,47 @@
|
|
12 |
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
-
* Class
|
16 |
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
|
|
|
|
|
|
21 |
*
|
22 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
23 |
*/
|
24 |
-
class RawCommand implements CommandInterface
|
25 |
{
|
26 |
private $slot;
|
27 |
private $commandID;
|
28 |
private $arguments;
|
29 |
|
30 |
/**
|
31 |
-
* @param
|
32 |
-
*
|
33 |
-
* @throws \InvalidArgumentException
|
34 |
*/
|
35 |
-
public function __construct(array $arguments)
|
36 |
{
|
37 |
-
|
38 |
-
|
39 |
-
'The arguments array must contain at least the command ID.'
|
40 |
-
);
|
41 |
-
}
|
42 |
-
|
43 |
-
$this->commandID = strtoupper(array_shift($arguments));
|
44 |
-
$this->arguments = $arguments;
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
* Creates a new raw command using a variadic method.
|
49 |
*
|
50 |
-
* @param string $commandID Redis command ID
|
51 |
-
* @param string ... Arguments list for the command
|
52 |
*
|
53 |
* @return CommandInterface
|
54 |
*/
|
55 |
public static function create($commandID /* [ $arg, ... */)
|
56 |
{
|
57 |
$arguments = func_get_args();
|
58 |
-
$command = new self($arguments);
|
59 |
|
60 |
-
return $
|
61 |
}
|
62 |
|
63 |
/**
|
12 |
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
+
* Class representing a generic Redis command.
|
16 |
*
|
17 |
+
* Arguments and responses for these commands are not normalized and they follow
|
18 |
+
* what is defined by the Redis documentation.
|
19 |
+
*
|
20 |
+
* Raw commands can be useful when implementing higher level abstractions on top
|
21 |
+
* of Predis\Client or managing internals like Redis Sentinel or Cluster as they
|
22 |
+
* are not potentially subject to hijacking from third party libraries when they
|
23 |
+
* override command handlers for standard Redis commands.
|
24 |
*
|
25 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
26 |
*/
|
27 |
+
final class RawCommand implements CommandInterface
|
28 |
{
|
29 |
private $slot;
|
30 |
private $commandID;
|
31 |
private $arguments;
|
32 |
|
33 |
/**
|
34 |
+
* @param string $commandID Command ID
|
35 |
+
* @param array $arguments Command arguments
|
|
|
36 |
*/
|
37 |
+
public function __construct($commandID, array $arguments = array())
|
38 |
{
|
39 |
+
$this->commandID = strtoupper($commandID);
|
40 |
+
$this->setArguments($arguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
* Creates a new raw command using a variadic method.
|
45 |
*
|
46 |
+
* @param string $commandID Redis command ID
|
47 |
+
* @param string ... Arguments list for the command
|
48 |
*
|
49 |
* @return CommandInterface
|
50 |
*/
|
51 |
public static function create($commandID /* [ $arg, ... */)
|
52 |
{
|
53 |
$arguments = func_get_args();
|
|
|
54 |
|
55 |
+
return new static(array_shift($arguments), $arguments);
|
56 |
}
|
57 |
|
58 |
/**
|
dependencies/predis/predis/src/Command/RawFactory.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Command factory creating raw command instances out of command IDs.
|
16 |
+
*
|
17 |
+
* Any command ID will produce a command instance even for unknown commands that
|
18 |
+
* are not implemented by Redis (the server will return a "-ERR unknown command"
|
19 |
+
* error responses).
|
20 |
+
*
|
21 |
+
* When using this factory the client does not process arguments before sending
|
22 |
+
* commands to Redis and server responses are not further processed before being
|
23 |
+
* returned to the caller.
|
24 |
+
*
|
25 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
26 |
+
*/
|
27 |
+
class RawFactory implements FactoryInterface
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* {@inheritdoc}
|
31 |
+
*/
|
32 |
+
public function supports(string ...$commandIDs): bool
|
33 |
+
{
|
34 |
+
return true;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* {@inheritdoc}
|
39 |
+
*/
|
40 |
+
public function create(string $commandID, array $arguments = []): CommandInterface
|
41 |
+
{
|
42 |
+
return new RawCommand($commandID, $arguments);
|
43 |
+
}
|
44 |
+
}
|
dependencies/predis/predis/src/Command/{StringAppend.php → Redis/APPEND.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/append
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/append
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class APPEND extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ConnectionAuth.php → Redis/AUTH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/auth
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/auth
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class AUTH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerBackgroundRewriteAOF.php → Redis/BGREWRITEAOF.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bgrewriteaof
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bgrewriteaof
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BGREWRITEAOF extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerBackgroundSave.php → Redis/BGSAVE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bgsave
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bgsave
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BGSAVE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringBitCount.php → Redis/BITCOUNT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bitcount
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bitcount
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BITCOUNT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringBitField.php → Redis/BITFIELD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bitfield
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bitfield
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BITFIELD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringBitOp.php → Redis/BITOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bitop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class StringBitOp extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
35 |
list($operation, $destination) = $arguments;
|
@@ -37,6 +39,6 @@ class StringBitOp extends Command
|
|
37 |
array_unshift($arguments, $operation, $destination);
|
38 |
}
|
39 |
|
40 |
-
|
41 |
}
|
42 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bitop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BITOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
37 |
list($operation, $destination) = $arguments;
|
39 |
array_unshift($arguments, $operation, $destination);
|
40 |
}
|
41 |
|
42 |
+
parent::setArguments($arguments);
|
43 |
}
|
44 |
}
|
dependencies/predis/predis/src/Command/{StringBitPos.php → Redis/BITPOS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/bitpos
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/bitpos
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BITPOS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPopFirstBlocking.php → Redis/BLPOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/blpop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,13 +31,13 @@ class ListPopFirstBlocking extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[0])) {
|
35 |
list($arguments, $timeout) = $arguments;
|
36 |
array_push($arguments, $timeout);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/blpop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BLPOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[0])) {
|
37 |
list($arguments, $timeout) = $arguments;
|
38 |
array_push($arguments, $timeout);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
}
|
dependencies/predis/predis/src/Command/{ListPopLastBlocking.php → Redis/BRPOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/brpop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,17 @@ class ListPopLastBlocking extends ListPopFirstBlocking
|
|
25 |
{
|
26 |
return 'BRPOP';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/brpop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BRPOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'BRPOP';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
if (count($arguments) === 2 && is_array($arguments[0])) {
|
37 |
+
list($arguments, $timeout) = $arguments;
|
38 |
+
array_push($arguments, $timeout);
|
39 |
+
}
|
40 |
+
|
41 |
+
parent::setArguments($arguments);
|
42 |
+
}
|
43 |
}
|
dependencies/predis/predis/src/Command/{ListPopLastPushHeadBlocking.php → Redis/BRPOPLPUSH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/brpoplpush
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/brpoplpush
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class BRPOPLPUSH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerClient.php → Redis/CLIENT.php}
RENAMED
@@ -9,7 +9,9 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/client-list
|
@@ -19,7 +21,7 @@ namespace Predis\Command;
|
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
21 |
*/
|
22 |
-
class
|
23 |
{
|
24 |
/**
|
25 |
* {@inheritdoc}
|
@@ -44,7 +46,7 @@ class ServerClient extends Command
|
|
44 |
case 'SETNAME':
|
45 |
default:
|
46 |
return $data;
|
47 |
-
}
|
48 |
}
|
49 |
|
50 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/client-list
|
21 |
*
|
22 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
23 |
*/
|
24 |
+
class CLIENT extends RedisCommand
|
25 |
{
|
26 |
/**
|
27 |
* {@inheritdoc}
|
46 |
case 'SETNAME':
|
47 |
default:
|
48 |
return $data;
|
49 |
+
} // @codeCoverageIgnore
|
50 |
}
|
51 |
|
52 |
/**
|
dependencies/predis/predis/src/Command/{ServerCommand.php → Redis/COMMAND.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/command
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as BaseCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/command
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class COMMAND extends BaseCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerConfig.php → Redis/CONFIG.php}
RENAMED
@@ -9,7 +9,9 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/config-set
|
@@ -19,7 +21,7 @@ namespace Predis\Command;
|
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
21 |
*/
|
22 |
-
class
|
23 |
{
|
24 |
/**
|
25 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/config-set
|
21 |
*
|
22 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
23 |
*/
|
24 |
+
class CONFIG extends RedisCommand
|
25 |
{
|
26 |
/**
|
27 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerDatabaseSize.php → Redis/DBSIZE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/dbsize
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/dbsize
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DBSIZE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringDecrement.php → Redis/DECR.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/decr
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/decr
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DECR extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringDecrementBy.php → Redis/DECRBY.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/decrby
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/decrby
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DECRBY extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyDelete.php → Redis/DEL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/del
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class KeyDelete extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/del
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DEL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{TransactionDiscard.php → Redis/DISCARD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/discard
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/discard
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DISCARD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyDump.php → Redis/DUMP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/dump
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/dump
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class DUMP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ConnectionEcho.php → Redis/ECHO_.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/echo
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/echo
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ECHO_ extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerEvalSHA.php → Redis/EVALSHA.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/evalsha
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/evalsha
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class EVALSHA extends EVAL_
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerEval.php → Redis/EVAL_.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/eval
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/eval
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class EVAL_ extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{TransactionExec.php → Redis/EXEC.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/exec
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/exec
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class EXEC extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyExists.php → Redis/EXISTS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/exists
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/exists
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class EXISTS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyExpire.php → Redis/EXPIRE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/expire
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/expire
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class EXPIRE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyExpireAt.php → Redis/EXPIREAT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/expireat
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/expireat
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class EXPIREAT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerFlushAll.php → Redis/FLUSHALL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/flushall
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/flushall
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class FLUSHALL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerFlushDatabase.php → Redis/FLUSHDB.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/flushdb
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/flushdb
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class FLUSHDB extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{GeospatialGeoAdd.php → Redis/GEOADD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/geoadd
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class GeospatialGeoAdd extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
foreach (array_pop($arguments) as $item) {
|
@@ -37,6 +39,6 @@ class GeospatialGeoAdd extends Command
|
|
37 |
}
|
38 |
}
|
39 |
|
40 |
-
|
41 |
}
|
42 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/geoadd
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GEOADD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
foreach (array_pop($arguments) as $item) {
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
parent::setArguments($arguments);
|
43 |
}
|
44 |
}
|
dependencies/predis/predis/src/Command/{GeospatialGeoDist.php → Redis/GEODIST.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/geodist
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/geodist
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GEODIST extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{GeospatialGeoHash.php → Redis/GEOHASH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/geohash
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,13 +31,13 @@ class GeospatialGeoHash extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
$members = array_pop($arguments);
|
36 |
$arguments = array_merge($arguments, $members);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/geohash
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GEOHASH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
$members = array_pop($arguments);
|
38 |
$arguments = array_merge($arguments, $members);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
}
|
dependencies/predis/predis/src/Command/{GeospatialGeoPos.php → Redis/GEOPOS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/geopos
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,13 +31,13 @@ class GeospatialGeoPos extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
$members = array_pop($arguments);
|
36 |
$arguments = array_merge($arguments, $members);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/geopos
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GEOPOS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
$members = array_pop($arguments);
|
38 |
$arguments = array_merge($arguments, $members);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
}
|
dependencies/predis/predis/src/Command/{GeospatialGeoRadius.php → Redis/GEORADIUS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/georadius
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class GeospatialGeoRadius extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if ($arguments && is_array(end($arguments))) {
|
35 |
$options = array_change_key_case(array_pop($arguments), CASE_UPPER);
|
@@ -66,6 +68,6 @@ class GeospatialGeoRadius extends Command
|
|
66 |
}
|
67 |
}
|
68 |
|
69 |
-
|
70 |
}
|
71 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/georadius
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GEORADIUS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if ($arguments && is_array(end($arguments))) {
|
37 |
$options = array_change_key_case(array_pop($arguments), CASE_UPPER);
|
68 |
}
|
69 |
}
|
70 |
|
71 |
+
parent::setArguments($arguments);
|
72 |
}
|
73 |
}
|
dependencies/predis/predis/src/Command/{GeospatialGeoRadiusByMember.php → Redis/GEORADIUSBYMEMBER.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/georadiusbymember
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/georadiusbymember
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class GEORADIUSBYMEMBER extends GEORADIUS
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringGet.php → Redis/GET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/get
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/get
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringGetBit.php → Redis/GETBIT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/getbit
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/getbit
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GETBIT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringGetRange.php → Redis/GETRANGE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/getrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/getrange
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GETRANGE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringGetSet.php → Redis/GETSET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/getset
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/getset
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class GETSET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashDelete.php → Redis/HDEL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hdel
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class HashDelete extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hdel
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HDEL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{HashExists.php → Redis/HEXISTS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hexists
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hexists
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HEXISTS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashGet.php → Redis/HGET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hget
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hget
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HGET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashGetAll.php → Redis/HGETALL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hgetall
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hgetall
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HGETALL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashIncrementBy.php → Redis/HINCRBY.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hincrby
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hincrby
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HINCRBY extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashIncrementByFloat.php → Redis/HINCRBYFLOAT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hincrbyfloat
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hincrbyfloat
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HINCRBYFLOAT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashKeys.php → Redis/HKEYS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hkeys
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hkeys
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HKEYS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashLength.php → Redis/HLEN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hlen
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hlen
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HLEN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashGetMultiple.php → Redis/HMGET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hmget
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class HashGetMultiple extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hmget
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HMGET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{HashSetMultiple.php → Redis/HMSET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hmset
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class HashSetMultiple extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
$flattenedKVs = array($arguments[0]);
|
@@ -40,9 +42,9 @@ class HashSetMultiple extends Command
|
|
40 |
$flattenedKVs[] = $v;
|
41 |
}
|
42 |
|
43 |
-
|
44 |
}
|
45 |
|
46 |
-
|
47 |
}
|
48 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hmset
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HMSET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
$flattenedKVs = array($arguments[0]);
|
42 |
$flattenedKVs[] = $v;
|
43 |
}
|
44 |
|
45 |
+
$arguments = $flattenedKVs;
|
46 |
}
|
47 |
|
48 |
+
parent::setArguments($arguments);
|
49 |
}
|
50 |
}
|
dependencies/predis/predis/src/Command/{HashScan.php → Redis/HSCAN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hscan
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,14 +31,14 @@ class HashScan extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
35 |
$options = $this->prepareOptions(array_pop($arguments));
|
36 |
$arguments = array_merge($arguments, $options);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hscan
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HSCAN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
37 |
$options = $this->prepareOptions(array_pop($arguments));
|
38 |
$arguments = array_merge($arguments, $options);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
|
44 |
/**
|
dependencies/predis/predis/src/Command/{HashSet.php → Redis/HSET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hset
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hset
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HSET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashSetPreserve.php → Redis/HSETNX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hsetnx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hsetnx
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HSETNX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashStringLength.php → Redis/HSTRLEN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hstrlen
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hstrlen
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HSTRLEN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HashValues.php → Redis/HVALS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/hvals
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/hvals
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class HVALS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringIncrement.php → Redis/INCR.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/incr
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/incr
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class INCR extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringIncrementBy.php → Redis/INCRBY.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/incrby
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/incrby
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class INCRBY extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringIncrementByFloat.php → Redis/INCRBYFLOAT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/incrbyfloat
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/incrbyfloat
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class INCRBYFLOAT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerInfo.php → Redis/INFO.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/info
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -30,11 +32,52 @@ class ServerInfo extends Command
|
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
public function parseResponse($data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
{
|
34 |
$info = array();
|
35 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
if (strpos($row, ':') === false) {
|
39 |
continue;
|
40 |
}
|
@@ -82,30 +125,4 @@ class ServerInfo extends Command
|
|
82 |
|
83 |
return $db;
|
84 |
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Parses the response and extracts the allocation statistics.
|
88 |
-
*
|
89 |
-
* @param string $str Response buffer.
|
90 |
-
*
|
91 |
-
* @return array
|
92 |
-
*/
|
93 |
-
protected function parseAllocationStats($str)
|
94 |
-
{
|
95 |
-
$stats = array();
|
96 |
-
|
97 |
-
foreach (explode(',', $str) as $kv) {
|
98 |
-
@list($size, $objects, $extra) = explode('=', $kv);
|
99 |
-
|
100 |
-
// hack to prevent incorrect values when parsing the >=256 key
|
101 |
-
if (isset($extra)) {
|
102 |
-
$size = ">=$objects";
|
103 |
-
$objects = $extra;
|
104 |
-
}
|
105 |
-
|
106 |
-
$stats[$size] = $objects;
|
107 |
-
}
|
108 |
-
|
109 |
-
return $stats;
|
110 |
-
}
|
111 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/info
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class INFO extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
public function parseResponse($data)
|
35 |
+
{
|
36 |
+
if (empty($data) || !$lines = preg_split('/\r?\n/', $data)) {
|
37 |
+
return array();
|
38 |
+
}
|
39 |
+
|
40 |
+
if (strpos($lines[0], '#') === 0) {
|
41 |
+
return $this->parseNewResponseFormat($lines);
|
42 |
+
} else {
|
43 |
+
return $this->parseOldResponseFormat($lines);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* {@inheritdoc}
|
49 |
+
*/
|
50 |
+
public function parseNewResponseFormat($lines)
|
51 |
{
|
52 |
$info = array();
|
53 |
+
$current = null;
|
54 |
+
|
55 |
+
foreach ($lines as $row) {
|
56 |
+
if ($row === '') {
|
57 |
+
continue;
|
58 |
+
}
|
59 |
+
|
60 |
+
if (preg_match('/^# (\w+)$/', $row, $matches)) {
|
61 |
+
$info[$matches[1]] = array();
|
62 |
+
$current = &$info[$matches[1]];
|
63 |
+
continue;
|
64 |
+
}
|
65 |
+
|
66 |
+
list($k, $v) = $this->parseRow($row);
|
67 |
+
$current[$k] = $v;
|
68 |
+
}
|
69 |
+
|
70 |
+
return $info;
|
71 |
+
}
|
72 |
|
73 |
+
/**
|
74 |
+
* {@inheritdoc}
|
75 |
+
*/
|
76 |
+
public function parseOldResponseFormat($lines)
|
77 |
+
{
|
78 |
+
$info = array();
|
79 |
+
|
80 |
+
foreach ($lines as $row) {
|
81 |
if (strpos($row, ':') === false) {
|
82 |
continue;
|
83 |
}
|
125 |
|
126 |
return $db;
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
dependencies/predis/predis/src/Command/{KeyKeys.php → Redis/KEYS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/keys
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/keys
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class KEYS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerLastSave.php → Redis/LASTSAVE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lastsave
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lastsave
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LASTSAVE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListIndex.php → Redis/LINDEX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lindex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lindex
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LINDEX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListInsert.php → Redis/LINSERT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/linsert
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/linsert
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LINSERT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListLength.php → Redis/LLEN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/llen
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/llen
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LLEN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPopFirst.php → Redis/LPOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lpop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lpop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LPOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPushHead.php → Redis/LPUSH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lpush
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,14 @@ class ListPushHead extends ListPushTail
|
|
25 |
{
|
26 |
return 'LPUSH';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lpush
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LPUSH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'LPUSH';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ListPushHeadX.php → Redis/LPUSHX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lpushx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lpushx
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LPUSHX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListRange.php → Redis/LRANGE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lrange
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LRANGE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListRemove.php → Redis/LREM.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lrem
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lrem
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LREM extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListSet.php → Redis/LSET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/lset
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/lset
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LSET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListTrim.php → Redis/LTRIM.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/ltrim
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/ltrim
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class LTRIM extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringGetMultiple.php → Redis/MGET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/mget
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class StringGetMultiple extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/mget
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MGET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{KeyMigrate.php → Redis/MIGRATE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/migrate
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class KeyMigrate extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (is_array(end($arguments))) {
|
35 |
foreach (array_pop($arguments) as $modifier => $value) {
|
@@ -45,6 +47,6 @@ class KeyMigrate extends Command
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
|
49 |
}
|
50 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/migrate
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MIGRATE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (is_array(end($arguments))) {
|
37 |
foreach (array_pop($arguments) as $modifier => $value) {
|
47 |
}
|
48 |
}
|
49 |
|
50 |
+
parent::setArguments($arguments);
|
51 |
}
|
52 |
}
|
dependencies/predis/predis/src/Command/{ServerMonitor.php → Redis/MONITOR.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/monitor
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/monitor
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MONITOR extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyMove.php → Redis/MOVE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/move
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/move
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MOVE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSetMultiple.php → Redis/MSET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/mset
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class StringSetMultiple extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 1 && is_array($arguments[0])) {
|
35 |
$flattenedKVs = array();
|
@@ -40,9 +42,9 @@ class StringSetMultiple extends Command
|
|
40 |
$flattenedKVs[] = $v;
|
41 |
}
|
42 |
|
43 |
-
|
44 |
}
|
45 |
|
46 |
-
|
47 |
}
|
48 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/mset
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MSET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 1 && is_array($arguments[0])) {
|
37 |
$flattenedKVs = array();
|
42 |
$flattenedKVs[] = $v;
|
43 |
}
|
44 |
|
45 |
+
$arguments = $flattenedKVs;
|
46 |
}
|
47 |
|
48 |
+
parent::setArguments($arguments);
|
49 |
}
|
50 |
}
|
dependencies/predis/predis/src/Command/{StringSetMultiplePreserve.php → Redis/MSETNX.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/msetnx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/msetnx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class MSETNX extends MSET
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{TransactionMulti.php → Redis/MULTI.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/multi
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/multi
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class MULTI extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerObject.php → Redis/OBJECT_.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/object
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/object
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class OBJECT_ extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyPersist.php → Redis/PERSIST.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/persist
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/persist
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PERSIST extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyPreciseExpire.php → Redis/PEXPIRE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pexpire
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pexpire
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PEXPIRE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyPreciseExpireAt.php → Redis/PEXPIREAT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pexpireat
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pexpireat
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PEXPIREAT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{HyperLogLogAdd.php → Redis/PFADD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pfadd
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class HyperLogLogAdd extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pfadd
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PFADD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{HyperLogLogCount.php → Redis/PFCOUNT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pfcount
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class HyperLogLogCount extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pfcount
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PFCOUNT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{HyperLogLogMerge.php → Redis/PFMERGE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pfmerge
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class HyperLogLogMerge extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pfmerge
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PFMERGE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ConnectionPing.php → Redis/PING.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/ping
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/ping
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PING extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringPreciseSetExpire.php → Redis/PSETEX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/psetex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/psetex
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PSETEX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubSubscribeByPattern.php → Redis/PSUBSCRIBE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/psubscribe
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,14 @@ class PubSubSubscribeByPattern extends PubSubSubscribe
|
|
25 |
{
|
26 |
return 'PSUBSCRIBE';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/psubscribe
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PSUBSCRIBE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'PSUBSCRIBE';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{KeyPreciseTimeToLive.php → Redis/PTTL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pttl
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pttl
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PTTL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubPublish.php → Redis/PUBLISH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/publish
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/publish
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PUBLISH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubPubsub.php → Redis/PUBSUB.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/pubsub
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/pubsub
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PUBSUB extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubUnsubscribeByPattern.php → Redis/PUNSUBSCRIBE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/punsubscribe
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,14 @@ class PubSubUnsubscribeByPattern extends PubSubUnsubscribe
|
|
25 |
{
|
26 |
return 'PUNSUBSCRIBE';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/punsubscribe
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class PUNSUBSCRIBE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'PUNSUBSCRIBE';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ConnectionQuit.php → Redis/QUIT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/quit
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/quit
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class QUIT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyRandom.php → Redis/RANDOMKEY.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/randomkey
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/randomkey
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RANDOMKEY extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyRename.php → Redis/RENAME.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/rename
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/rename
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RENAME extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyRenamePreserve.php → Redis/RENAMENX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/renamenx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/renamenx
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RENAMENX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyRestore.php → Redis/RESTORE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/restore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/restore
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RESTORE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPopLast.php → Redis/RPOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/rpop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/rpop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RPOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPopLastPushHead.php → Redis/RPOPLPUSH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/rpoplpush
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/rpoplpush
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RPOPLPUSH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ListPushTail.php → Redis/RPUSH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/rpush
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class ListPushTail extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/rpush
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RPUSH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ListPushTailX.php → Redis/RPUSHX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/rpushx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/rpushx
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class RPUSHX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetAdd.php → Redis/SADD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sadd
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class SetAdd extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sadd
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SADD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ServerSave.php → Redis/SAVE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/save
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/save
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SAVE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyScan.php → Redis/SCAN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/scan
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,14 +31,14 @@ class KeyScan extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
$options = $this->prepareOptions(array_pop($arguments));
|
36 |
$arguments = array_merge($arguments, $options);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/scan
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SCAN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
$options = $this->prepareOptions(array_pop($arguments));
|
38 |
$arguments = array_merge($arguments, $options);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
|
44 |
/**
|
dependencies/predis/predis/src/Command/{SetCardinality.php → Redis/SCARD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/scard
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/scard
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SCARD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerScript.php → Redis/SCRIPT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/script
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/script
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SCRIPT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetDifference.php → Redis/SDIFF.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sdiff
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,14 @@ class SetDifference extends SetIntersection
|
|
25 |
{
|
26 |
return 'SDIFF';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sdiff
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SDIFF extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'SDIFF';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
}
|
dependencies/predis/predis/src/Command/Redis/SDIFFSTORE.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @link http://redis.io/commands/sdiffstore
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class SDIFFSTORE extends RedisCommand
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function getId()
|
27 |
+
{
|
28 |
+
return 'SDIFFSTORE';
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
+
$arguments = array_merge(array($arguments[0]), $arguments[1]);
|
38 |
+
}
|
39 |
+
|
40 |
+
parent::setArguments($arguments);
|
41 |
+
}
|
42 |
+
}
|
dependencies/predis/predis/src/Command/{ConnectionSelect.php → Redis/SELECT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/select
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/select
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SELECT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerSentinel.php → Redis/SENTINEL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/topics/sentinel
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/topics/sentinel
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SENTINEL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSet.php → Redis/SET.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/set
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/set
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SET extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSetBit.php → Redis/SETBIT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/setbit
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/setbit
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SETBIT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSetExpire.php → Redis/SETEX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/setex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/setex
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SETEX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSetPreserve.php → Redis/SETNX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/setnx
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/setnx
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SETNX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{StringSetRange.php → Redis/SETRANGE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/setrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/setrange
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SETRANGE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerShutdown.php → Redis/SHUTDOWN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/shutdown
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/shutdown
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SHUTDOWN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetIntersection.php → Redis/SINTER.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sinter
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class SetIntersection extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sinter
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SINTER extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{SetIntersectionStore.php → Redis/SINTERSTORE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sinterstore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,12 +31,12 @@ class SetIntersectionStore extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
35 |
-
|
36 |
}
|
37 |
|
38 |
-
|
39 |
}
|
40 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sinterstore
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SINTERSTORE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
+
$arguments = array_merge(array($arguments[0]), $arguments[1]);
|
38 |
}
|
39 |
|
40 |
+
parent::setArguments($arguments);
|
41 |
}
|
42 |
}
|
dependencies/predis/predis/src/Command/{SetIsMember.php → Redis/SISMEMBER.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sismember
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sismember
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SISMEMBER extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ServerSlaveOf.php → Redis/SLAVEOF.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/slaveof
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,12 +31,12 @@ class ServerSlaveOf extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 0 || $arguments[0] === 'NO ONE') {
|
35 |
-
|
36 |
}
|
37 |
|
38 |
-
|
39 |
}
|
40 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/slaveof
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SLAVEOF extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 0 || $arguments[0] === 'NO ONE') {
|
37 |
+
$arguments = array('NO', 'ONE');
|
38 |
}
|
39 |
|
40 |
+
parent::setArguments($arguments);
|
41 |
}
|
42 |
}
|
dependencies/predis/predis/src/Command/{ServerSlowlog.php → Redis/SLOWLOG.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/slowlog
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/slowlog
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SLOWLOG extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetMembers.php → Redis/SMEMBERS.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/smembers
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/smembers
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SMEMBERS extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetMove.php → Redis/SMOVE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/smove
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/smove
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SMOVE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeySort.php → Redis/SORT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sort
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,10 +31,12 @@ class KeySort extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 1) {
|
35 |
-
|
|
|
|
|
36 |
}
|
37 |
|
38 |
$query = array($arguments[0]);
|
@@ -78,6 +82,6 @@ class KeySort extends Command
|
|
78 |
$query[] = $sortParams['STORE'];
|
79 |
}
|
80 |
|
81 |
-
|
82 |
}
|
83 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sort
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SORT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 1) {
|
37 |
+
parent::setArguments($arguments);
|
38 |
+
|
39 |
+
return;
|
40 |
}
|
41 |
|
42 |
$query = array($arguments[0]);
|
82 |
$query[] = $sortParams['STORE'];
|
83 |
}
|
84 |
|
85 |
+
parent::setArguments($query);
|
86 |
}
|
87 |
}
|
dependencies/predis/predis/src/Command/{SetPop.php → Redis/SPOP.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/spop
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/spop
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SPOP extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetRandomMember.php → Redis/SRANDMEMBER.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/srandmember
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/srandmember
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SRANDMEMBER extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetRemove.php → Redis/SREM.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/srem
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class SetRemove extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/srem
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SREM extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{SetScan.php → Redis/SSCAN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sscan
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,14 +31,14 @@ class SetScan extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
35 |
$options = $this->prepareOptions(array_pop($arguments));
|
36 |
$arguments = array_merge($arguments, $options);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sscan
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SSCAN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
37 |
$options = $this->prepareOptions(array_pop($arguments));
|
38 |
$arguments = array_merge($arguments, $options);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
|
44 |
/**
|
dependencies/predis/predis/src/Command/{StringStrlen.php → Redis/STRLEN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/strlen
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/strlen
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class STRLEN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubSubscribe.php → Redis/SUBSCRIBE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/subscribe
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class PubSubSubscribe extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/subscribe
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SUBSCRIBE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{StringSubstr.php → Redis/SUBSTR.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/substr
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/substr
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SUBSTR extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{SetUnion.php → Redis/SUNION.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/sunion
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -25,4 +27,14 @@ class SetUnion extends SetIntersection
|
|
25 |
{
|
26 |
return 'SUNION';
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/sunion
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class SUNION extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
27 |
{
|
28 |
return 'SUNION';
|
29 |
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
}
|
dependencies/predis/predis/src/Command/Redis/SUNIONSTORE.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @link http://redis.io/commands/sunionstore
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class SUNIONSTORE extends RedisCommand
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function getId()
|
27 |
+
{
|
28 |
+
return 'SUNIONSTORE';
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
if (count($arguments) === 2 && is_array($arguments[1])) {
|
37 |
+
$arguments = array_merge(array($arguments[0]), $arguments[1]);
|
38 |
+
}
|
39 |
+
|
40 |
+
parent::setArguments($arguments);
|
41 |
+
}
|
42 |
+
}
|
dependencies/predis/predis/src/Command/{ServerTime.php → Redis/TIME.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/time
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/time
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class TIME extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/Redis/TOUCH.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @link http://redis.io/commands/touch
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class TOUCH extends RedisCommand
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function getId()
|
27 |
+
{
|
28 |
+
return 'TOUCH';
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
+
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
+
}
|
40 |
+
}
|
dependencies/predis/predis/src/Command/{KeyTimeToLive.php → Redis/TTL.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/ttl
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/ttl
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class TTL extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{KeyType.php → Redis/TYPE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/type
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/type
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class TYPE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{PubSubUnsubscribe.php → Redis/UNSUBSCRIBE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/unsubscribe
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class PubSubUnsubscribe extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/unsubscribe
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class UNSUBSCRIBE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeArguments($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{TransactionUnwatch.php → Redis/UNWATCH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/unwatch
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/unwatch
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class UNWATCH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{TransactionWatch.php → Redis/WATCH.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/watch
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,12 +31,12 @@ class TransactionWatch extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (isset($arguments[0]) && is_array($arguments[0])) {
|
35 |
-
|
36 |
}
|
37 |
|
38 |
-
|
39 |
}
|
40 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/watch
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class WATCH extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (isset($arguments[0]) && is_array($arguments[0])) {
|
37 |
+
$arguments = $arguments[0];
|
38 |
}
|
39 |
|
40 |
+
parent::setArguments($arguments);
|
41 |
}
|
42 |
}
|
dependencies/predis/predis/src/Command/{ZSetAdd.php → Redis/ZADD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zadd
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class ZSetAdd extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (is_array(end($arguments))) {
|
35 |
foreach (array_pop($arguments) as $member => $score) {
|
@@ -38,6 +40,6 @@ class ZSetAdd extends Command
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
-
|
42 |
}
|
43 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zadd
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZADD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (is_array(end($arguments))) {
|
37 |
foreach (array_pop($arguments) as $member => $score) {
|
40 |
}
|
41 |
}
|
42 |
|
43 |
+
parent::setArguments($arguments);
|
44 |
}
|
45 |
}
|
dependencies/predis/predis/src/Command/{ZSetCardinality.php → Redis/ZCARD.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zcard
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zcard
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZCARD extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetCount.php → Redis/ZCOUNT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zcount
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zcount
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZCOUNT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetIncrementBy.php → Redis/ZINCRBY.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zincrby
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zincrby
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZINCRBY extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetIntersectionStore.php → Redis/ZINTERSTORE.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zinterstore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zinterstore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZINTERSTORE extends ZUNIONSTORE
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetLexCount.php → Redis/ZLEXCOUNT.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zlexcount
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zlexcount
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZLEXCOUNT extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/Redis/ZPOPMAX.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @link http://redis.io/commands/zpopmax
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class ZPOPMAX extends RedisCommand
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function getId()
|
27 |
+
{
|
28 |
+
return 'ZPOPMAX';
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function parseResponse($data)
|
35 |
+
{
|
36 |
+
$result = array();
|
37 |
+
|
38 |
+
for ($i = 0; $i < count($data); ++$i) {
|
39 |
+
$result[$data[$i]] = $data[++$i];
|
40 |
+
}
|
41 |
+
|
42 |
+
return $result;
|
43 |
+
}
|
44 |
+
}
|
dependencies/predis/predis/src/Command/Redis/ZPOPMIN.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @link http://redis.io/commands/zpopmin
|
18 |
+
*
|
19 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
+
*/
|
21 |
+
class ZPOPMIN extends RedisCommand
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function getId()
|
27 |
+
{
|
28 |
+
return 'ZPOPMIN';
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function parseResponse($data)
|
35 |
+
{
|
36 |
+
$result = array();
|
37 |
+
|
38 |
+
for ($i = 0; $i < count($data); ++$i) {
|
39 |
+
$result[$data[$i]] = $data[++$i];
|
40 |
+
}
|
41 |
+
|
42 |
+
return $result;
|
43 |
+
}
|
44 |
+
}
|
dependencies/predis/predis/src/Command/{ZSetRange.php → Redis/ZRANGE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class ZSetRange extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 4) {
|
35 |
$lastType = gettype($arguments[3]);
|
@@ -42,12 +44,11 @@ class ZSetRange extends Command
|
|
42 |
|
43 |
if ($lastType === 'array') {
|
44 |
$options = $this->prepareOptions(array_pop($arguments));
|
45 |
-
|
46 |
-
return array_merge($arguments, $options);
|
47 |
}
|
48 |
}
|
49 |
|
50 |
-
|
51 |
}
|
52 |
|
53 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zrange
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZRANGE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 4) {
|
37 |
$lastType = gettype($arguments[3]);
|
44 |
|
45 |
if ($lastType === 'array') {
|
46 |
$options = $this->prepareOptions(array_pop($arguments));
|
47 |
+
$arguments = array_merge($arguments, $options);
|
|
|
48 |
}
|
49 |
}
|
50 |
|
51 |
+
parent::setArguments($arguments);
|
52 |
}
|
53 |
|
54 |
/**
|
dependencies/predis/predis/src/Command/{ZSetRangeByLex.php → Redis/ZRANGEBYLEX.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrangebylex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrangebylex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZRANGEBYLEX extends ZRANGE
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetRangeByScore.php → Redis/ZRANGEBYSCORE.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrangebyscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrangebyscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZRANGEBYSCORE extends ZRANGE
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetRank.php → Redis/ZRANK.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrank
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zrank
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZRANK extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetRemove.php → Redis/ZREM.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrem
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,8 +31,10 @@ class ZSetRemove extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zrem
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZREM extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
+
$arguments = self::normalizeVariadic($arguments);
|
37 |
+
|
38 |
+
parent::setArguments($arguments);
|
39 |
}
|
40 |
}
|
dependencies/predis/predis/src/Command/{ZSetRemoveRangeByLex.php → Redis/ZREMRANGEBYLEX.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zremrangebylex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zremrangebylex
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZREMRANGEBYLEX extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetRemoveRangeByRank.php → Redis/ZREMRANGEBYRANK.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zremrangebyrank
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zremrangebyrank
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZREMRANGEBYRANK extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetRemoveRangeByScore.php → Redis/ZREMRANGEBYSCORE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zremrangebyscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zremrangebyscore
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZREMRANGEBYSCORE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetReverseRange.php → Redis/ZREVRANGE.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrange
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZREVRANGE extends ZRANGE
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetReverseRangeByLex.php → Redis/ZREVRANGEBYLEX.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrangebylex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrangebylex
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZREVRANGEBYLEX extends ZRANGEBYLEX
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetReverseRangeByScore.php → Redis/ZREVRANGEBYSCORE.php}
RENAMED
@@ -9,14 +9,14 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrangebyscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrangebyscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
+
class ZREVRANGEBYSCORE extends ZRANGEBYSCORE
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetReverseRank.php → Redis/ZREVRANK.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zrevrank
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zrevrank
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZREVRANK extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetScan.php → Redis/ZSCAN.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zscan
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,14 +31,14 @@ class ZSetScan extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
35 |
$options = $this->prepareOptions(array_pop($arguments));
|
36 |
$arguments = array_merge($arguments, $options);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zscan
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZSCAN extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
if (count($arguments) === 3 && is_array($arguments[2])) {
|
37 |
$options = $this->prepareOptions(array_pop($arguments));
|
38 |
$arguments = array_merge($arguments, $options);
|
39 |
}
|
40 |
|
41 |
+
parent::setArguments($arguments);
|
42 |
}
|
43 |
|
44 |
/**
|
dependencies/predis/predis/src/Command/{ZSetScore.php → Redis/ZSCORE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zscore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zscore
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZSCORE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Command/{ZSetUnionStore.php → Redis/ZUNIONSTORE.php}
RENAMED
@@ -9,14 +9,16 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Command;
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* @link http://redis.io/commands/zunionstore
|
16 |
*
|
17 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
@@ -29,7 +31,7 @@ class ZSetUnionStore extends Command
|
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
32 |
-
|
33 |
{
|
34 |
$options = array();
|
35 |
$argc = count($arguments);
|
@@ -45,7 +47,7 @@ class ZSetUnionStore extends Command
|
|
45 |
);
|
46 |
}
|
47 |
|
48 |
-
|
49 |
}
|
50 |
|
51 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Command\Redis;
|
13 |
+
|
14 |
+
use Predis\Command\Command as RedisCommand;
|
15 |
|
16 |
/**
|
17 |
* @link http://redis.io/commands/zunionstore
|
18 |
*
|
19 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
*/
|
21 |
+
class ZUNIONSTORE extends RedisCommand
|
22 |
{
|
23 |
/**
|
24 |
* {@inheritdoc}
|
31 |
/**
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
+
public function setArguments(array $arguments)
|
35 |
{
|
36 |
$options = array();
|
37 |
$argc = count($arguments);
|
47 |
);
|
48 |
}
|
49 |
|
50 |
+
parent::setArguments(array_merge($arguments, $options));
|
51 |
}
|
52 |
|
53 |
/**
|
dependencies/predis/predis/src/Command/RedisFactory.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Command;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Command factory for mainline Redis servers.
|
16 |
+
*
|
17 |
+
* This factory is intended to handle standard commands implemented by mainline
|
18 |
+
* Redis servers. By default it maps a command ID to a specific command handler
|
19 |
+
* class in the Predis\Command\Redis namespace but this can be overridden for
|
20 |
+
* any command ID simply by defining a new command handler class implementing
|
21 |
+
* Predis\Command\CommandInterface.
|
22 |
+
*
|
23 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
24 |
+
*/
|
25 |
+
class RedisFactory extends Factory
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
$this->commands = array(
|
33 |
+
'ECHO' => 'Predis\Command\Redis\ECHO_',
|
34 |
+
'EVAL' => 'Predis\Command\Redis\EVAL_',
|
35 |
+
'OBJECT' => 'Predis\Command\Redis\OBJECT_',
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* {@inheritdoc}
|
41 |
+
*/
|
42 |
+
public function getCommandClass(string $commandID): ?string
|
43 |
+
{
|
44 |
+
$commandID = strtoupper($commandID);
|
45 |
+
|
46 |
+
if (isset($this->commands[$commandID]) || array_key_exists($commandID, $this->commands)) {
|
47 |
+
$commandClass = $this->commands[$commandID];
|
48 |
+
} elseif (class_exists($commandClass = "Predis\Command\Redis\\$commandID")) {
|
49 |
+
$this->commands[$commandID] = $commandClass;
|
50 |
+
} else {
|
51 |
+
return null;
|
52 |
+
}
|
53 |
+
|
54 |
+
return $commandClass;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* {@inheritdoc}
|
59 |
+
*/
|
60 |
+
public function undefine(string $commandID): void
|
61 |
+
{
|
62 |
+
// NOTE: we explicitly associate `NULL` to the command ID in the map
|
63 |
+
// instead of the parent's `unset()` because our subclass tries to load
|
64 |
+
// a predefined class from the Predis\Command\Redis namespace when no
|
65 |
+
// explicit mapping is defined, see RedisFactory::getCommandClass() for
|
66 |
+
// details of the implementation of this mechanism.
|
67 |
+
$this->commands[strtoupper($commandID)] = null;
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
dependencies/predis/predis/src/Command/ScriptCommand.php
CHANGED
@@ -19,8 +19,16 @@ namespace Predis\Command;
|
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
21 |
*/
|
22 |
-
abstract class ScriptCommand extends
|
23 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/**
|
25 |
* Gets the body of a Lua script.
|
26 |
*
|
@@ -28,6 +36,16 @@ abstract class ScriptCommand extends ServerEvalSHA
|
|
28 |
*/
|
29 |
abstract public function getScript();
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* Specifies the number of arguments that should be considered as keys.
|
33 |
*
|
@@ -55,16 +73,20 @@ abstract class ScriptCommand extends ServerEvalSHA
|
|
55 |
/**
|
56 |
* {@inheritdoc}
|
57 |
*/
|
58 |
-
|
59 |
{
|
60 |
if (($numkeys = $this->getKeysCount()) && $numkeys < 0) {
|
61 |
$numkeys = count($arguments) + $numkeys;
|
62 |
}
|
63 |
|
64 |
-
|
|
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
|
|
|
|
68 |
* @return array
|
69 |
*/
|
70 |
public function getEvalArguments()
|
@@ -74,4 +96,14 @@ abstract class ScriptCommand extends ServerEvalSHA
|
|
74 |
|
75 |
return $arguments;
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
21 |
*/
|
22 |
+
abstract class ScriptCommand extends Command
|
23 |
{
|
24 |
+
/**
|
25 |
+
* {@inheritdoc}
|
26 |
+
*/
|
27 |
+
public function getId()
|
28 |
+
{
|
29 |
+
return 'EVALSHA';
|
30 |
+
}
|
31 |
+
|
32 |
/**
|
33 |
* Gets the body of a Lua script.
|
34 |
*
|
36 |
*/
|
37 |
abstract public function getScript();
|
38 |
|
39 |
+
/**
|
40 |
+
* Calculates the SHA1 hash of the body of the script.
|
41 |
+
*
|
42 |
+
* @return string SHA1 hash.
|
43 |
+
*/
|
44 |
+
public function getScriptHash()
|
45 |
+
{
|
46 |
+
return sha1($this->getScript());
|
47 |
+
}
|
48 |
+
|
49 |
/**
|
50 |
* Specifies the number of arguments that should be considered as keys.
|
51 |
*
|
73 |
/**
|
74 |
* {@inheritdoc}
|
75 |
*/
|
76 |
+
public function setArguments(array $arguments)
|
77 |
{
|
78 |
if (($numkeys = $this->getKeysCount()) && $numkeys < 0) {
|
79 |
$numkeys = count($arguments) + $numkeys;
|
80 |
}
|
81 |
|
82 |
+
$arguments = array_merge(array($this->getScriptHash(), (int) $numkeys), $arguments);
|
83 |
+
|
84 |
+
parent::setArguments($arguments);
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
+
* Returns arguments for EVAL command.
|
89 |
+
*
|
90 |
* @return array
|
91 |
*/
|
92 |
public function getEvalArguments()
|
96 |
|
97 |
return $arguments;
|
98 |
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Returns the equivalent EVAL command as a raw command instance.
|
102 |
+
*
|
103 |
+
* @return RawCommand
|
104 |
+
*/
|
105 |
+
public function getEvalCommand()
|
106 |
+
{
|
107 |
+
return new RawCommand('EVAL', $this->getEvalArguments());
|
108 |
+
}
|
109 |
}
|
dependencies/predis/predis/src/Command/ServerInfoV26x.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Command;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @link http://redis.io/commands/info
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class ServerInfoV26x extends ServerInfo
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function parseResponse($data)
|
25 |
-
{
|
26 |
-
if ($data === '') {
|
27 |
-
return array();
|
28 |
-
}
|
29 |
-
|
30 |
-
$info = array();
|
31 |
-
|
32 |
-
$current = null;
|
33 |
-
$infoLines = preg_split('/\r?\n/', $data);
|
34 |
-
|
35 |
-
if (isset($infoLines[0]) && $infoLines[0][0] !== '#') {
|
36 |
-
return parent::parseResponse($data);
|
37 |
-
}
|
38 |
-
|
39 |
-
foreach ($infoLines as $row) {
|
40 |
-
if ($row === '') {
|
41 |
-
continue;
|
42 |
-
}
|
43 |
-
|
44 |
-
if (preg_match('/^# (\w+)$/', $row, $matches)) {
|
45 |
-
$info[$matches[1]] = array();
|
46 |
-
$current = &$info[$matches[1]];
|
47 |
-
continue;
|
48 |
-
}
|
49 |
-
|
50 |
-
list($k, $v) = $this->parseRow($row);
|
51 |
-
$current[$k] = $v;
|
52 |
-
}
|
53 |
-
|
54 |
-
return $info;
|
55 |
-
}
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Command/SetDifferenceStore.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Command;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @link http://redis.io/commands/sdiffstore
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class SetDifferenceStore extends SetIntersectionStore
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getId()
|
25 |
-
{
|
26 |
-
return 'SDIFFSTORE';
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Command/SetUnionStore.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Command;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @link http://redis.io/commands/sunionstore
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class SetUnionStore extends SetIntersectionStore
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getId()
|
25 |
-
{
|
26 |
-
return 'SUNIONSTORE';
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/CommunicationException.php
CHANGED
@@ -26,12 +26,12 @@ abstract class CommunicationException extends PredisException
|
|
26 |
* @param NodeConnectionInterface $connection Connection that generated the exception.
|
27 |
* @param string $message Error message.
|
28 |
* @param int $code Error code.
|
29 |
-
* @param \Exception
|
30 |
*/
|
31 |
public function __construct(
|
32 |
NodeConnectionInterface $connection,
|
33 |
-
$message =
|
34 |
-
$code =
|
35 |
\Exception $innerException = null
|
36 |
) {
|
37 |
parent::__construct(
|
26 |
* @param NodeConnectionInterface $connection Connection that generated the exception.
|
27 |
* @param string $message Error message.
|
28 |
* @param int $code Error code.
|
29 |
+
* @param \Exception|null $innerException Inner exception for wrapping the original error.
|
30 |
*/
|
31 |
public function __construct(
|
32 |
NodeConnectionInterface $connection,
|
33 |
+
$message = "",
|
34 |
+
$code = 0,
|
35 |
\Exception $innerException = null
|
36 |
) {
|
37 |
parent::__construct(
|
dependencies/predis/predis/src/Configuration/ClusterOption.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Configuration;
|
13 |
-
|
14 |
-
use Predis\Connection\Aggregate\ClusterInterface;
|
15 |
-
use Predis\Connection\Aggregate\PredisCluster;
|
16 |
-
use Predis\Connection\Aggregate\RedisCluster;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Configures an aggregate connection used for clustering
|
20 |
-
* multiple Redis nodes using various implementations with
|
21 |
-
* different algorithms or strategies.
|
22 |
-
*
|
23 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
24 |
-
*/
|
25 |
-
class ClusterOption implements OptionInterface
|
26 |
-
{
|
27 |
-
/**
|
28 |
-
* Creates a new cluster connection from on a known descriptive name.
|
29 |
-
*
|
30 |
-
* @param OptionsInterface $options Instance of the client options.
|
31 |
-
* @param string $id Descriptive identifier of the cluster type (`predis`, `redis-cluster`)
|
32 |
-
*
|
33 |
-
* @return ClusterInterface|null
|
34 |
-
*/
|
35 |
-
protected function createByDescription(OptionsInterface $options, $id)
|
36 |
-
{
|
37 |
-
switch ($id) {
|
38 |
-
case 'predis':
|
39 |
-
case 'predis-cluster':
|
40 |
-
return new PredisCluster();
|
41 |
-
|
42 |
-
case 'redis':
|
43 |
-
case 'redis-cluster':
|
44 |
-
return new RedisCluster($options->connections);
|
45 |
-
|
46 |
-
default:
|
47 |
-
return;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* {@inheritdoc}
|
53 |
-
*/
|
54 |
-
public function filter(OptionsInterface $options, $value)
|
55 |
-
{
|
56 |
-
if (is_string($value)) {
|
57 |
-
$value = $this->createByDescription($options, $value);
|
58 |
-
}
|
59 |
-
|
60 |
-
if (!$value instanceof ClusterInterface) {
|
61 |
-
throw new \InvalidArgumentException(
|
62 |
-
"An instance of type 'Predis\Connection\Aggregate\ClusterInterface' was expected."
|
63 |
-
);
|
64 |
-
}
|
65 |
-
|
66 |
-
return $value;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* {@inheritdoc}
|
71 |
-
*/
|
72 |
-
public function getDefault(OptionsInterface $options)
|
73 |
-
{
|
74 |
-
return new PredisCluster();
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Configuration/ConnectionFactoryOption.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Configuration;
|
13 |
-
|
14 |
-
use Predis\Connection\Factory;
|
15 |
-
use Predis\Connection\FactoryInterface;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Configures a connection factory used by the client to create new connection
|
19 |
-
* instances for single Redis nodes.
|
20 |
-
*
|
21 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
-
*/
|
23 |
-
class ConnectionFactoryOption implements OptionInterface
|
24 |
-
{
|
25 |
-
/**
|
26 |
-
* {@inheritdoc}
|
27 |
-
*/
|
28 |
-
public function filter(OptionsInterface $options, $value)
|
29 |
-
{
|
30 |
-
if ($value instanceof FactoryInterface) {
|
31 |
-
return $value;
|
32 |
-
} elseif (is_array($value)) {
|
33 |
-
$factory = $this->getDefault($options);
|
34 |
-
|
35 |
-
foreach ($value as $scheme => $initializer) {
|
36 |
-
$factory->define($scheme, $initializer);
|
37 |
-
}
|
38 |
-
|
39 |
-
return $factory;
|
40 |
-
} else {
|
41 |
-
throw new \InvalidArgumentException(
|
42 |
-
'Invalid value provided for the connections option.'
|
43 |
-
);
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* {@inheritdoc}
|
49 |
-
*/
|
50 |
-
public function getDefault(OptionsInterface $options)
|
51 |
-
{
|
52 |
-
$factory = new Factory();
|
53 |
-
|
54 |
-
if ($options->defined('parameters')) {
|
55 |
-
$factory->setDefaultParameters($options->parameters);
|
56 |
-
}
|
57 |
-
|
58 |
-
return $factory;
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Configuration/Option/Aggregate.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use InvalidArgumentException;
|
15 |
+
use Predis\Configuration\OptionInterface;
|
16 |
+
use Predis\Configuration\OptionsInterface;
|
17 |
+
use Predis\Connection\AggregateConnectionInterface;
|
18 |
+
use Predis\Connection\NodeConnectionInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Client option for configuring generic aggregate connections.
|
22 |
+
*
|
23 |
+
* The only value accepted by this option is a callable that must return a valid
|
24 |
+
* connection instance of Predis\Connection\AggregateConnectionInterface when
|
25 |
+
* invoked by the client to create a new aggregate connection instance.
|
26 |
+
*
|
27 |
+
* Creation and configuration of the aggregate connection is up to the user.
|
28 |
+
*
|
29 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
30 |
+
*/
|
31 |
+
class Aggregate implements OptionInterface
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* {@inheritdoc}
|
35 |
+
*/
|
36 |
+
public function filter(OptionsInterface $options, $value)
|
37 |
+
{
|
38 |
+
if (!is_callable($value)) {
|
39 |
+
throw new InvalidArgumentException(sprintf(
|
40 |
+
'%s expects a callable object acting as an aggregate connection initializer',
|
41 |
+
static::class
|
42 |
+
));
|
43 |
+
}
|
44 |
+
|
45 |
+
return $this->getConnectionInitializer($options, $value);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Wraps a user-supplied callable used to create a new aggregate connection.
|
50 |
+
*
|
51 |
+
* When the original callable acting as a connection initializer is executed
|
52 |
+
* by the client to create a new aggregate connection, it will receive the
|
53 |
+
* following arguments:
|
54 |
+
*
|
55 |
+
* - $parameters (same as passed to Predis\Client::__construct())
|
56 |
+
* - $options (options container, Predis\Configuration\OptionsInterface)
|
57 |
+
* - $option (current option, Predis\Configuration\OptionInterface)
|
58 |
+
*
|
59 |
+
* The original callable must return a valid aggregation connection instance
|
60 |
+
* of type Predis\Connection\AggregateConnectionInterface, this is enforced
|
61 |
+
* by the wrapper returned by this method and an exception is thrown when
|
62 |
+
* invalid values are returned.
|
63 |
+
*
|
64 |
+
* @param OptionsInterface $options Client options
|
65 |
+
* @param callable $callable Callable initializer
|
66 |
+
*
|
67 |
+
* @throws InvalidArgumentException
|
68 |
+
*
|
69 |
+
* @return callable
|
70 |
+
*/
|
71 |
+
protected function getConnectionInitializer(OptionsInterface $options, callable $callable)
|
72 |
+
{
|
73 |
+
return function ($parameters = null, $autoaggregate = false) use ($callable, $options) {
|
74 |
+
$connection = call_user_func_array($callable, [&$parameters, $options, $this]);
|
75 |
+
|
76 |
+
if (!$connection instanceof AggregateConnectionInterface) {
|
77 |
+
throw new InvalidArgumentException(sprintf(
|
78 |
+
'%s expects the supplied callable to return an instance of %s, but %s was returned',
|
79 |
+
static::class,
|
80 |
+
AggregateConnectionInterface::class,
|
81 |
+
is_object($connection) ? get_class($connection) : gettype($connection)
|
82 |
+
));
|
83 |
+
}
|
84 |
+
|
85 |
+
if ($parameters && $autoaggregate) {
|
86 |
+
static::aggregate($options, $connection, $parameters);
|
87 |
+
}
|
88 |
+
|
89 |
+
return $connection;
|
90 |
+
};
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Adds single connections to an aggregate connection instance.
|
95 |
+
*
|
96 |
+
* @param OptionsInterface $options Client options
|
97 |
+
* @param AggregateConnectionInterface $connection Target aggregate connection
|
98 |
+
* @param array $nodes List of nodes to be added to the target aggregate connection
|
99 |
+
*/
|
100 |
+
public static function aggregate(OptionsInterface $options, AggregateConnectionInterface $connection, array $nodes)
|
101 |
+
{
|
102 |
+
$connections = $options->connections;
|
103 |
+
|
104 |
+
foreach ($nodes as $node) {
|
105 |
+
$connection->add($node instanceof NodeConnectionInterface ? $node : $connections->create($node));
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* {@inheritdoc}
|
111 |
+
*/
|
112 |
+
public function getDefault(OptionsInterface $options)
|
113 |
+
{
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
}
|
dependencies/predis/predis/src/Configuration/Option/CRC16.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use Predis\Cluster\Hash;
|
15 |
+
use Predis\Configuration\OptionInterface;
|
16 |
+
use Predis\Configuration\OptionsInterface;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Configures an hash generator used by the redis-cluster connection backend.
|
20 |
+
*
|
21 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
+
*/
|
23 |
+
class CRC16 implements OptionInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an hash generator instance from a descriptive name.
|
27 |
+
*
|
28 |
+
* @param OptionsInterface $options Client options.
|
29 |
+
* @param string $description Identifier of a hash generator (`predis`, `phpiredis`)
|
30 |
+
*
|
31 |
+
* @return callable
|
32 |
+
*/
|
33 |
+
protected function getHashGeneratorByDescription(OptionsInterface $options, $description)
|
34 |
+
{
|
35 |
+
if ($description === 'predis') {
|
36 |
+
return new Hash\CRC16();
|
37 |
+
} elseif ($description === 'phpiredis') {
|
38 |
+
return new Hash\PhpiredisCRC16();
|
39 |
+
} else {
|
40 |
+
throw new \InvalidArgumentException(
|
41 |
+
'String value for the crc16 option must be either `predis` or `phpiredis`'
|
42 |
+
);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* {@inheritdoc}
|
48 |
+
*/
|
49 |
+
public function filter(OptionsInterface $options, $value)
|
50 |
+
{
|
51 |
+
if (is_callable($value)) {
|
52 |
+
$value = call_user_func($value, $options);
|
53 |
+
}
|
54 |
+
|
55 |
+
if (is_string($value)) {
|
56 |
+
return $this->getHashGeneratorByDescription($options, $value);
|
57 |
+
} elseif ($value instanceof Hash\HashGeneratorInterface) {
|
58 |
+
return $value;
|
59 |
+
} else {
|
60 |
+
$class = get_class($this);
|
61 |
+
throw new \InvalidArgumentException("$class expects a valid hash generator");
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* {@inheritdoc}
|
67 |
+
*/
|
68 |
+
public function getDefault(OptionsInterface $options)
|
69 |
+
{
|
70 |
+
return function_exists('phpiredis_utils_crc16')
|
71 |
+
? new Hash\PhpiredisCRC16()
|
72 |
+
: new Hash\CRC16();
|
73 |
+
}
|
74 |
+
}
|
dependencies/predis/predis/src/Configuration/Option/Cluster.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use InvalidArgumentException;
|
15 |
+
use Predis\Cluster\RedisStrategy;
|
16 |
+
use Predis\Configuration\OptionsInterface;
|
17 |
+
use Predis\Connection\Cluster\PredisCluster;
|
18 |
+
use Predis\Connection\Cluster\RedisCluster;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Configures an aggregate connection used for clustering
|
22 |
+
* multiple Redis nodes using various implementations with
|
23 |
+
* different algorithms or strategies.
|
24 |
+
*
|
25 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
26 |
+
*/
|
27 |
+
class Cluster extends Aggregate
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* {@inheritdoc}
|
31 |
+
*/
|
32 |
+
public function filter(OptionsInterface $options, $value)
|
33 |
+
{
|
34 |
+
if (is_string($value)) {
|
35 |
+
$value = $this->getConnectionInitializerByString($options, $value);
|
36 |
+
}
|
37 |
+
|
38 |
+
if (is_callable($value)) {
|
39 |
+
return $this->getConnectionInitializer($options, $value);
|
40 |
+
} else {
|
41 |
+
throw new InvalidArgumentException(sprintf(
|
42 |
+
'%s expects either a string or a callable value, %s given',
|
43 |
+
static::class,
|
44 |
+
is_object($value) ? get_class($value) : gettype($value)
|
45 |
+
));
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Returns a connection initializer from a descriptive name.
|
51 |
+
*
|
52 |
+
* @param OptionsInterface $options Client options
|
53 |
+
* @param string $description Identifier of a replication backend (`predis`, `sentinel`)
|
54 |
+
*
|
55 |
+
* @return callable
|
56 |
+
*/
|
57 |
+
protected function getConnectionInitializerByString(OptionsInterface $options, string $description)
|
58 |
+
{
|
59 |
+
switch ($description) {
|
60 |
+
case 'redis':
|
61 |
+
case 'redis-cluster':
|
62 |
+
return function ($parameters, $options, $option) {
|
63 |
+
return new RedisCluster($options->connections, new RedisStrategy($options->crc16));
|
64 |
+
};
|
65 |
+
|
66 |
+
case 'predis':
|
67 |
+
return $this->getDefaultConnectionInitializer();
|
68 |
+
|
69 |
+
default:
|
70 |
+
throw new InvalidArgumentException(sprintf(
|
71 |
+
'%s expects either `predis`, `redis` or `redis-cluster` as valid string values, `%s` given',
|
72 |
+
static::class,
|
73 |
+
$description
|
74 |
+
));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Returns the default connection initializer.
|
80 |
+
*
|
81 |
+
* @return callable
|
82 |
+
*/
|
83 |
+
protected function getDefaultConnectionInitializer()
|
84 |
+
{
|
85 |
+
return function ($parameters, $options, $option) {
|
86 |
+
return new PredisCluster();
|
87 |
+
};
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* {@inheritdoc}
|
92 |
+
*/
|
93 |
+
public function getDefault(OptionsInterface $options)
|
94 |
+
{
|
95 |
+
return $this->getConnectionInitializer(
|
96 |
+
$options,
|
97 |
+
$this->getDefaultConnectionInitializer()
|
98 |
+
);
|
99 |
+
}
|
100 |
+
}
|
dependencies/predis/predis/src/Configuration/Option/Commands.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use Predis\Command\FactoryInterface;
|
15 |
+
use Predis\Command\RawFactory;
|
16 |
+
use Predis\Command\RedisFactory;
|
17 |
+
use Predis\Configuration\OptionInterface;
|
18 |
+
use Predis\Configuration\OptionsInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Configures a connection factory to be used by the client.
|
22 |
+
*
|
23 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
24 |
+
*/
|
25 |
+
class Commands implements OptionInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* {@inheritdoc}
|
29 |
+
*/
|
30 |
+
public function filter(OptionsInterface $options, $value)
|
31 |
+
{
|
32 |
+
if (is_callable($value)) {
|
33 |
+
$value = call_user_func($value, $options);
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($value instanceof FactoryInterface) {
|
37 |
+
return $value;
|
38 |
+
} elseif (is_array($value)) {
|
39 |
+
return $this->createFactoryByArray($options, $value);
|
40 |
+
} elseif(is_string($value)) {
|
41 |
+
return $this->createFactoryByString($options, $value);
|
42 |
+
} else {
|
43 |
+
throw new \InvalidArgumentException(sprintf(
|
44 |
+
'%s expects a valid command factory',
|
45 |
+
static::class
|
46 |
+
));
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Creates a new default command factory from a named array.
|
52 |
+
*
|
53 |
+
* The factory instance is configured according to the supplied named array
|
54 |
+
* mapping command IDs (passed as keys) to the FCQN of classes implementing
|
55 |
+
* Predis\Command\CommandInterface.
|
56 |
+
*
|
57 |
+
* @param OptionsInterface $options Client options container
|
58 |
+
* @param array $value Named array mapping command IDs to classes
|
59 |
+
*
|
60 |
+
* @return FactoryInterface
|
61 |
+
*/
|
62 |
+
protected function createFactoryByArray(OptionsInterface $options, array $value)
|
63 |
+
{
|
64 |
+
/**
|
65 |
+
* @var FactoryInterface
|
66 |
+
*/
|
67 |
+
$commands = $this->getDefault($options);
|
68 |
+
|
69 |
+
foreach ($value as $commandID => $commandClass) {
|
70 |
+
if ($commandClass === null) {
|
71 |
+
$commands->undefine($commandID);
|
72 |
+
} else {
|
73 |
+
$commands->define($commandID, $commandClass);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return $commands;
|
78 |
+
}
|
79 |
+
/**
|
80 |
+
* Creates a new command factory from a descriptive string.
|
81 |
+
*
|
82 |
+
* The factory instance is configured according to the supplied descriptive
|
83 |
+
* string that identifies specific configurations of schemes and connection
|
84 |
+
* classes. Supported configuration values are:
|
85 |
+
*
|
86 |
+
* - "predis" returns the default command factory used by Predis
|
87 |
+
* - "raw" returns a command factory that creates only raw commands
|
88 |
+
* - "default" is simply an alias of "predis"
|
89 |
+
*
|
90 |
+
* @param OptionsInterface $options Client options container
|
91 |
+
* @param string $value Descriptive string identifying the desired configuration
|
92 |
+
*
|
93 |
+
* @return FactoryInterface
|
94 |
+
*/
|
95 |
+
protected function createFactoryByString(OptionsInterface $options, string $value)
|
96 |
+
{
|
97 |
+
switch (strtolower($value)) {
|
98 |
+
case 'default':
|
99 |
+
case 'predis':
|
100 |
+
return $this->getDefault($options);
|
101 |
+
|
102 |
+
case 'raw':
|
103 |
+
return $this->createRawFactory($options);
|
104 |
+
|
105 |
+
default:
|
106 |
+
throw new \InvalidArgumentException(sprintf(
|
107 |
+
'%s does not recognize `%s` as a supported configuration string',
|
108 |
+
static::class,
|
109 |
+
$value
|
110 |
+
));
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Creates a new raw command factory instance.
|
116 |
+
*
|
117 |
+
* @param OptionsInterface $options Client options container
|
118 |
+
*/
|
119 |
+
protected function createRawFactory(OptionsInterface $options): FactoryInterface
|
120 |
+
{
|
121 |
+
$commands = new RawFactory();
|
122 |
+
|
123 |
+
if (isset($options->prefix)) {
|
124 |
+
throw new \InvalidArgumentException(sprintf(
|
125 |
+
'%s does not support key prefixing', RawFactory::class
|
126 |
+
));
|
127 |
+
}
|
128 |
+
|
129 |
+
return $commands;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* {@inheritdoc}
|
134 |
+
*/
|
135 |
+
public function getDefault(OptionsInterface $options)
|
136 |
+
{
|
137 |
+
$commands = new RedisFactory();
|
138 |
+
|
139 |
+
if (isset($options->prefix)) {
|
140 |
+
$commands->setProcessor($options->prefix);
|
141 |
+
}
|
142 |
+
|
143 |
+
return $commands;
|
144 |
+
}
|
145 |
+
}
|
dependencies/predis/predis/src/Configuration/Option/Connections.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use Predis\Configuration\OptionInterface;
|
15 |
+
use Predis\Configuration\OptionsInterface;
|
16 |
+
use Predis\Connection\Factory;
|
17 |
+
use Predis\Connection\FactoryInterface;
|
18 |
+
use Predis\Connection\PhpiredisStreamConnection;
|
19 |
+
use Predis\Connection\PhpiredisSocketConnection;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Configures a new connection factory instance.
|
23 |
+
*
|
24 |
+
* The client uses the connection factory to create the underlying connections
|
25 |
+
* to single redis nodes in a single-server configuration or in replication and
|
26 |
+
* cluster configurations.
|
27 |
+
*
|
28 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
29 |
+
*/
|
30 |
+
class Connections implements OptionInterface
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* {@inheritdoc}
|
34 |
+
*/
|
35 |
+
public function filter(OptionsInterface $options, $value)
|
36 |
+
{
|
37 |
+
if (is_callable($value)) {
|
38 |
+
$value = call_user_func($value, $options);
|
39 |
+
}
|
40 |
+
|
41 |
+
if ($value instanceof FactoryInterface) {
|
42 |
+
return $value;
|
43 |
+
} elseif (is_array($value)) {
|
44 |
+
return $this->createFactoryByArray($options, $value);
|
45 |
+
} elseif (is_string($value)) {
|
46 |
+
return $this->createFactoryByString($options, $value);
|
47 |
+
} else {
|
48 |
+
throw new \InvalidArgumentException(sprintf(
|
49 |
+
'%s expects a valid connection factory', static::class
|
50 |
+
));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Creates a new connection factory from a named array.
|
56 |
+
*
|
57 |
+
* The factory instance is configured according to the supplied named array
|
58 |
+
* mapping URI schemes (passed as keys) to the FCQN of classes implementing
|
59 |
+
* Predis\Connection\NodeConnectionInterface, or callable objects acting as
|
60 |
+
* lazy initalizers and returning new instances of classes implementing
|
61 |
+
* Predis\Connection\NodeConnectionInterface.
|
62 |
+
*
|
63 |
+
* @param OptionsInterface $options Client options
|
64 |
+
* @param array $value Named array mapping URI schemes to classes or callables
|
65 |
+
*
|
66 |
+
* @return FactoryInterface
|
67 |
+
*/
|
68 |
+
protected function createFactoryByArray(OptionsInterface $options, array $value)
|
69 |
+
{
|
70 |
+
/**
|
71 |
+
* @var FactoryInterface
|
72 |
+
*/
|
73 |
+
$factory = $this->getDefault($options);
|
74 |
+
|
75 |
+
foreach ($value as $scheme => $initializer) {
|
76 |
+
$factory->define($scheme, $initializer);
|
77 |
+
}
|
78 |
+
|
79 |
+
return $factory;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Creates a new connection factory from a descriptive string.
|
84 |
+
*
|
85 |
+
* The factory instance is configured according to the supplied descriptive
|
86 |
+
* string that identifies specific configurations of schemes and connection
|
87 |
+
* classes. Supported configuration values are:
|
88 |
+
*
|
89 |
+
* - "phpiredis-stream" maps tcp, redis, unix to PhpiredisStreamConnection
|
90 |
+
* - "phpiredis-socket" maps tcp, redis, unix to PhpiredisSocketConnection
|
91 |
+
* - "phpiredis" is an alias of "phpiredis-stream"
|
92 |
+
*
|
93 |
+
* @param OptionsInterface $options Client options
|
94 |
+
* @param string $value Descriptive string identifying the desired configuration
|
95 |
+
*
|
96 |
+
* @return FactoryInterface
|
97 |
+
*/
|
98 |
+
protected function createFactoryByString(OptionsInterface $options, string $value)
|
99 |
+
{
|
100 |
+
/**
|
101 |
+
* @var FactoryInterface
|
102 |
+
*/
|
103 |
+
$factory = $this->getDefault($options);
|
104 |
+
|
105 |
+
switch(strtolower($value)) {
|
106 |
+
case 'phpiredis':
|
107 |
+
case 'phpiredis-stream':
|
108 |
+
$factory->define('tcp', PhpiredisStreamConnection::class);
|
109 |
+
$factory->define('redis', PhpiredisStreamConnection::class);
|
110 |
+
$factory->define('unix', PhpiredisStreamConnection::class);
|
111 |
+
break;
|
112 |
+
|
113 |
+
case 'phpiredis-socket':
|
114 |
+
$factory->define('tcp', PhpiredisSocketConnection::class);
|
115 |
+
$factory->define('redis', PhpiredisSocketConnection::class);
|
116 |
+
$factory->define('unix', PhpiredisSocketConnection::class);
|
117 |
+
break;
|
118 |
+
|
119 |
+
case 'default':
|
120 |
+
return $factory;
|
121 |
+
|
122 |
+
default:
|
123 |
+
throw new \InvalidArgumentException(sprintf(
|
124 |
+
'%s does not recognize `%s` as a supported configuration string', static::class, $value
|
125 |
+
));
|
126 |
+
}
|
127 |
+
|
128 |
+
return $factory;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* {@inheritdoc}
|
133 |
+
*/
|
134 |
+
public function getDefault(OptionsInterface $options)
|
135 |
+
{
|
136 |
+
$factory = new Factory();
|
137 |
+
|
138 |
+
if ($options->defined('parameters')) {
|
139 |
+
$factory->setDefaultParameters($options->parameters);
|
140 |
+
}
|
141 |
+
|
142 |
+
return $factory;
|
143 |
+
}
|
144 |
+
}
|
dependencies/predis/predis/src/Configuration/{ExceptionsOption.php → Option/Exceptions.php}
RENAMED
@@ -9,7 +9,10 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Configuration;
|
|
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* Configures whether consumers (such as the client) should throw exceptions on
|
@@ -17,7 +20,7 @@ namespace Predis\Configuration;
|
|
17 |
*
|
18 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
19 |
*/
|
20 |
-
class
|
21 |
{
|
22 |
/**
|
23 |
* {@inheritdoc}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use Predis\Configuration\OptionInterface;
|
15 |
+
use Predis\Configuration\OptionsInterface;
|
16 |
|
17 |
/**
|
18 |
* Configures whether consumers (such as the client) should throw exceptions on
|
20 |
*
|
21 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
*/
|
23 |
+
class Exceptions implements OptionInterface
|
24 |
{
|
25 |
/**
|
26 |
* {@inheritdoc}
|
dependencies/predis/predis/src/Configuration/{PrefixOption.php → Option/Prefix.php}
RENAMED
@@ -9,10 +9,12 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Configuration;
|
13 |
|
14 |
use Predis\Command\Processor\KeyPrefixProcessor;
|
15 |
use Predis\Command\Processor\ProcessorInterface;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* Configures a command processor that apply the specified prefix string to a
|
@@ -20,18 +22,22 @@ use Predis\Command\Processor\ProcessorInterface;
|
|
20 |
*
|
21 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
/**
|
26 |
* {@inheritdoc}
|
27 |
*/
|
28 |
public function filter(OptionsInterface $options, $value)
|
29 |
{
|
|
|
|
|
|
|
|
|
30 |
if ($value instanceof ProcessorInterface) {
|
31 |
return $value;
|
32 |
}
|
33 |
|
34 |
-
return new KeyPrefixProcessor($value);
|
35 |
}
|
36 |
|
37 |
/**
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
|
14 |
use Predis\Command\Processor\KeyPrefixProcessor;
|
15 |
use Predis\Command\Processor\ProcessorInterface;
|
16 |
+
use Predis\Configuration\OptionInterface;
|
17 |
+
use Predis\Configuration\OptionsInterface;
|
18 |
|
19 |
/**
|
20 |
* Configures a command processor that apply the specified prefix string to a
|
22 |
*
|
23 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
24 |
*/
|
25 |
+
class Prefix implements OptionInterface
|
26 |
{
|
27 |
/**
|
28 |
* {@inheritdoc}
|
29 |
*/
|
30 |
public function filter(OptionsInterface $options, $value)
|
31 |
{
|
32 |
+
if (is_callable($value)) {
|
33 |
+
$value = call_user_func($value, $options);
|
34 |
+
}
|
35 |
+
|
36 |
if ($value instanceof ProcessorInterface) {
|
37 |
return $value;
|
38 |
}
|
39 |
|
40 |
+
return new KeyPrefixProcessor((string) $value);
|
41 |
}
|
42 |
|
43 |
/**
|
dependencies/predis/predis/src/Configuration/Option/Replication.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Predis package.
|
5 |
+
*
|
6 |
+
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Predis\Configuration\Option;
|
13 |
+
|
14 |
+
use InvalidArgumentException;
|
15 |
+
use Predis\Configuration\OptionsInterface;
|
16 |
+
use Predis\Connection\AggregateConnectionInterface;
|
17 |
+
use Predis\Connection\Replication\MasterSlaveReplication;
|
18 |
+
use Predis\Connection\Replication\SentinelReplication;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Configures an aggregate connection used for master/slave replication among
|
22 |
+
* multiple Redis nodes.
|
23 |
+
*
|
24 |
+
* @author Daniele Alessandri <suppakilla@gmail.com>
|
25 |
+
*/
|
26 |
+
class Replication extends Aggregate
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* {@inheritdoc}
|
30 |
+
*/
|
31 |
+
public function filter(OptionsInterface $options, $value)
|
32 |
+
{
|
33 |
+
if (is_string($value)) {
|
34 |
+
$value = $this->getConnectionInitializerByString($options, $value);
|
35 |
+
}
|
36 |
+
|
37 |
+
if (is_callable($value)) {
|
38 |
+
return $this->getConnectionInitializer($options, $value);
|
39 |
+
} else {
|
40 |
+
throw new InvalidArgumentException(sprintf(
|
41 |
+
'%s expects either a string or a callable value, %s given',
|
42 |
+
static::class,
|
43 |
+
is_object($value) ? get_class($value) : gettype($value)
|
44 |
+
));
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns a connection initializer (callable) from a descriptive string.
|
50 |
+
*
|
51 |
+
* Each connection initializer is specialized for the specified replication
|
52 |
+
* backend so that all the necessary steps for the configuration of the new
|
53 |
+
* aggregate connection are performed inside the initializer and the client
|
54 |
+
* receives a ready-to-use connection.
|
55 |
+
*
|
56 |
+
* Supported configuration values are:
|
57 |
+
*
|
58 |
+
* - `predis` for unmanaged replication setups
|
59 |
+
* - `redis-sentinel` for replication setups managed by redis-sentinel
|
60 |
+
* - `sentinel` is an alias of `redis-sentinel`
|
61 |
+
*
|
62 |
+
* @param OptionsInterface $options Client options
|
63 |
+
* @param string $description Identifier of a replication backend
|
64 |
+
*
|
65 |
+
* @return callable
|
66 |
+
*/
|
67 |
+
protected function getConnectionInitializerByString(OptionsInterface $options, string $description)
|
68 |
+
{
|
69 |
+
switch ($description) {
|
70 |
+
case 'sentinel':
|
71 |
+
case 'redis-sentinel':
|
72 |
+
return function ($parameters, $options, $option) {
|
73 |
+
return new SentinelReplication($options->service, $parameters, $options->connections);
|
74 |
+
};
|
75 |
+
|
76 |
+
case 'predis':
|
77 |
+
return $this->getDefaultConnectionInitializer($options);
|
78 |
+
|
79 |
+
default:
|
80 |
+
throw new InvalidArgumentException(sprintf(
|
81 |
+
'%s expects either `predis`, `sentinel` or `redis-sentinel` as valid string values, `%s` given',
|
82 |
+
static::class,
|
83 |
+
$description
|
84 |
+
));
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns the default connection initializer.
|
90 |
+
*
|
91 |
+
* @return callable
|
92 |
+
*/
|
93 |
+
protected function getDefaultConnectionInitializer()
|
94 |
+
{
|
95 |
+
return function ($parameters, $options, $option) {
|
96 |
+
$connection = new MasterSlaveReplication();
|
97 |
+
|
98 |
+
if ($options->autodiscovery) {
|
99 |
+
$connection->setConnectionFactory($options->connections);
|
100 |
+
$connection->setAutoDiscovery(true);
|
101 |
+
}
|
102 |
+
|
103 |
+
return $connection;
|
104 |
+
};
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* {@inheritdoc}
|
109 |
+
*/
|
110 |
+
public static function aggregate(OptionsInterface $options, AggregateConnectionInterface $connection, array $nodes)
|
111 |
+
{
|
112 |
+
// TODO: at least for now we will replicate the previous behaviour of
|
113 |
+
// skipping automatic aggregation when using the redis-sentinel backend
|
114 |
+
// because $nodes contains an array of sentinel servers instead of Redis
|
115 |
+
// servers and SentinelReplication already gets the list of sentinels in
|
116 |
+
// the first argument of its constructor. SentinelReplication::add()
|
117 |
+
// actually knows how to handle connections marked with role=sentinel in
|
118 |
+
// their parameters but relying on it would require an explicit role to
|
119 |
+
// be set by the user and I would like to avoid enforcing that for now.
|
120 |
+
if (!$connection instanceof SentinelReplication) {
|
121 |
+
parent::aggregate($options, $connection, $nodes);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* {@inheritdoc}
|
127 |
+
*/
|
128 |
+
public function getDefault(OptionsInterface $options)
|
129 |
+
{
|
130 |
+
return $this->getConnectionInitializer(
|
131 |
+
$options,
|
132 |
+
$this->getDefaultConnectionInitializer()
|
133 |
+
);
|
134 |
+
}
|
135 |
+
}
|
dependencies/predis/predis/src/Configuration/Options.php
CHANGED
@@ -12,8 +12,10 @@
|
|
12 |
namespace Predis\Configuration;
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
-
*
|
|
|
|
|
17 |
*
|
18 |
* {@inheritdoc}
|
19 |
*
|
@@ -21,35 +23,30 @@ namespace Predis\Configuration;
|
|
21 |
*/
|
22 |
class Options implements OptionsInterface
|
23 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
protected $input;
|
25 |
-
protected $options;
|
26 |
-
protected $handlers;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @param array $options Array of options with their values
|
30 |
-
*/
|
31 |
-
public function __construct(array $options = array())
|
32 |
-
{
|
33 |
-
$this->input = $options;
|
34 |
-
$this->options = array();
|
35 |
-
$this->handlers = $this->getHandlers();
|
36 |
-
}
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
-
*
|
41 |
-
* @return array
|
42 |
*/
|
43 |
-
|
44 |
{
|
45 |
-
|
46 |
-
'cluster' => 'Predis\Configuration\ClusterOption',
|
47 |
-
'connections' => 'Predis\Configuration\ConnectionFactoryOption',
|
48 |
-
'exceptions' => 'Predis\Configuration\ExceptionsOption',
|
49 |
-
'prefix' => 'Predis\Configuration\PrefixOption',
|
50 |
-
'profile' => 'Predis\Configuration\ProfileOption',
|
51 |
-
'replication' => 'Predis\Configuration\ReplicationOption',
|
52 |
-
);
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -100,14 +97,12 @@ class Options implements OptionsInterface
|
|
100 |
$value = $this->input[$option];
|
101 |
unset($this->input[$option]);
|
102 |
|
103 |
-
if (is_object($value) && method_exists($value, '__invoke')) {
|
104 |
-
$value = $value($this, $option);
|
105 |
-
}
|
106 |
-
|
107 |
if (isset($this->handlers[$option])) {
|
108 |
$handler = $this->handlers[$option];
|
109 |
$handler = new $handler();
|
110 |
$value = $handler->filter($this, $value);
|
|
|
|
|
111 |
}
|
112 |
|
113 |
return $this->options[$option] = $value;
|
12 |
namespace Predis\Configuration;
|
13 |
|
14 |
/**
|
15 |
+
* Default client options container for Predis\Client.
|
16 |
+
*
|
17 |
+
* Pre-defined options have their specialized handlers that can filter, convert
|
18 |
+
* an lazily initialize values in a mini-DI container approach.
|
19 |
*
|
20 |
* {@inheritdoc}
|
21 |
*
|
23 |
*/
|
24 |
class Options implements OptionsInterface
|
25 |
{
|
26 |
+
/** @var array */
|
27 |
+
protected $handlers = [
|
28 |
+
'aggregate' => Option\Aggregate::class,
|
29 |
+
'cluster' => Option\Cluster::class,
|
30 |
+
'replication' => Option\Replication::class,
|
31 |
+
'connections' => Option\Connections::class,
|
32 |
+
'commands' => Option\Commands::class,
|
33 |
+
'exceptions' => Option\Exceptions::class,
|
34 |
+
'prefix' => Option\Prefix::class,
|
35 |
+
'crc16' => Option\CRC16::class,
|
36 |
+
];
|
37 |
+
|
38 |
+
/** @var array */
|
39 |
+
protected $options = [];
|
40 |
+
|
41 |
+
/** @var array */
|
42 |
protected $input;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
/**
|
45 |
+
* @param array $options Named array of client options
|
|
|
|
|
46 |
*/
|
47 |
+
public function __construct(array $options = null)
|
48 |
{
|
49 |
+
$this->input = $options ?? [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
/**
|
97 |
$value = $this->input[$option];
|
98 |
unset($this->input[$option]);
|
99 |
|
|
|
|
|
|
|
|
|
100 |
if (isset($this->handlers[$option])) {
|
101 |
$handler = $this->handlers[$option];
|
102 |
$handler = new $handler();
|
103 |
$value = $handler->filter($this, $value);
|
104 |
+
} elseif (is_object($value) && method_exists($value, '__invoke')) {
|
105 |
+
$value = $value($this);
|
106 |
}
|
107 |
|
108 |
return $this->options[$option] = $value;
|
dependencies/predis/predis/src/Configuration/OptionsInterface.php
CHANGED
@@ -12,21 +12,14 @@
|
|
12 |
namespace Predis\Configuration;
|
13 |
|
14 |
use Predis\Command\Processor\ProcessorInterface;
|
15 |
-
use Predis\Connection\Aggregate\ClusterInterface;
|
16 |
-
use Predis\Connection\Aggregate\ReplicationInterface;
|
17 |
-
use Predis\Connection\FactoryInterface;
|
18 |
-
use Predis\Profile\ProfileInterface;
|
19 |
-
|
20 |
/**
|
21 |
-
*
|
22 |
-
*
|
23 |
-
* @property-read
|
24 |
-
* @property-read
|
25 |
-
* @property-read
|
26 |
-
* @property-read
|
27 |
-
* @property-read
|
28 |
-
* @property-read ProfileInterface $profile Server profile.
|
29 |
-
* @property-read ReplicationInterface $replication Aggregate connection for replication.
|
30 |
*
|
31 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
32 |
*/
|
@@ -35,7 +28,7 @@ interface OptionsInterface
|
|
35 |
/**
|
36 |
* Returns the default value for the given option.
|
37 |
*
|
38 |
-
* @param string $option Name of the option
|
39 |
*
|
40 |
* @return mixed|null
|
41 |
*/
|
@@ -44,7 +37,7 @@ interface OptionsInterface
|
|
44 |
/**
|
45 |
* Checks if the given option has been set by the user upon initialization.
|
46 |
*
|
47 |
-
* @param string $option Name of the option
|
48 |
*
|
49 |
* @return bool
|
50 |
*/
|
@@ -53,7 +46,7 @@ interface OptionsInterface
|
|
53 |
/**
|
54 |
* Checks if the given option has been set and does not evaluate to NULL.
|
55 |
*
|
56 |
-
* @param string $option Name of the option
|
57 |
*
|
58 |
* @return bool
|
59 |
*/
|
@@ -62,7 +55,7 @@ interface OptionsInterface
|
|
62 |
/**
|
63 |
* Returns the value of the given option.
|
64 |
*
|
65 |
-
* @param string $option Name of the option
|
66 |
*
|
67 |
* @return mixed|null
|
68 |
*/
|
12 |
namespace Predis\Configuration;
|
13 |
|
14 |
use Predis\Command\Processor\ProcessorInterface;
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
+
* @property-read callable $aggregate Custom aggregate connection initializer
|
17 |
+
* @property-read callable $cluster Aggregate connection initializer for clustering
|
18 |
+
* @property-read Connection\FactoryInterface $connections Connection factory for creating new connections
|
19 |
+
* @property-read bool $exceptions Toggles exceptions in client for -ERR responses
|
20 |
+
* @property-read ProcessorInterface $prefix Key prefixing strategy using the supplied string as prefix
|
21 |
+
* @property-read Command\FactoryInterface $commands Command factory for creating Redis commands
|
22 |
+
* @property-read callable $replication Aggregate connection initializer for replication
|
|
|
|
|
23 |
*
|
24 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
25 |
*/
|
28 |
/**
|
29 |
* Returns the default value for the given option.
|
30 |
*
|
31 |
+
* @param string $option Name of the option
|
32 |
*
|
33 |
* @return mixed|null
|
34 |
*/
|
37 |
/**
|
38 |
* Checks if the given option has been set by the user upon initialization.
|
39 |
*
|
40 |
+
* @param string $option Name of the option
|
41 |
*
|
42 |
* @return bool
|
43 |
*/
|
46 |
/**
|
47 |
* Checks if the given option has been set and does not evaluate to NULL.
|
48 |
*
|
49 |
+
* @param string $option Name of the option
|
50 |
*
|
51 |
* @return bool
|
52 |
*/
|
55 |
/**
|
56 |
* Returns the value of the given option.
|
57 |
*
|
58 |
+
* @param string $option Name of the option
|
59 |
*
|
60 |
* @return mixed|null
|
61 |
*/
|
dependencies/predis/predis/src/Configuration/ProfileOption.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Configuration;
|
13 |
-
|
14 |
-
use Predis\Profile\Factory;
|
15 |
-
use Predis\Profile\ProfileInterface;
|
16 |
-
use Predis\Profile\RedisProfile;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Configures the server profile to be used by the client to create command
|
20 |
-
* instances depending on the specified version of the Redis server.
|
21 |
-
*
|
22 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
23 |
-
*/
|
24 |
-
class ProfileOption implements OptionInterface
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* Sets the commands processors that need to be applied to the profile.
|
28 |
-
*
|
29 |
-
* @param OptionsInterface $options Client options.
|
30 |
-
* @param ProfileInterface $profile Server profile.
|
31 |
-
*/
|
32 |
-
protected function setProcessors(OptionsInterface $options, ProfileInterface $profile)
|
33 |
-
{
|
34 |
-
if (isset($options->prefix) && $profile instanceof RedisProfile) {
|
35 |
-
// NOTE: directly using __get('prefix') is actually a workaround for
|
36 |
-
// HHVM 2.3.0. It's correct and respects the options interface, it's
|
37 |
-
// just ugly. We will remove this hack when HHVM will fix re-entrant
|
38 |
-
// calls to __get() once and for all.
|
39 |
-
|
40 |
-
$profile->setProcessor($options->__get('prefix'));
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* {@inheritdoc}
|
46 |
-
*/
|
47 |
-
public function filter(OptionsInterface $options, $value)
|
48 |
-
{
|
49 |
-
if (is_string($value)) {
|
50 |
-
$value = Factory::get($value);
|
51 |
-
$this->setProcessors($options, $value);
|
52 |
-
} elseif (!$value instanceof ProfileInterface) {
|
53 |
-
throw new \InvalidArgumentException('Invalid value for the profile option.');
|
54 |
-
}
|
55 |
-
|
56 |
-
return $value;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* {@inheritdoc}
|
61 |
-
*/
|
62 |
-
public function getDefault(OptionsInterface $options)
|
63 |
-
{
|
64 |
-
$profile = Factory::getDefault();
|
65 |
-
$this->setProcessors($options, $profile);
|
66 |
-
|
67 |
-
return $profile;
|
68 |
-
}
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Configuration/ReplicationOption.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Configuration;
|
13 |
-
|
14 |
-
use Predis\Connection\Aggregate\MasterSlaveReplication;
|
15 |
-
use Predis\Connection\Aggregate\ReplicationInterface;
|
16 |
-
use Predis\Connection\Aggregate\SentinelReplication;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Configures an aggregate connection used for master/slave replication among
|
20 |
-
* multiple Redis nodes.
|
21 |
-
*
|
22 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
23 |
-
*/
|
24 |
-
class ReplicationOption implements OptionInterface
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* {@inheritdoc}
|
28 |
-
*
|
29 |
-
* @todo There's more code than needed due to a bug in filter_var() as
|
30 |
-
* discussed here https://bugs.php.net/bug.php?id=49510 and different
|
31 |
-
* behaviours when encountering NULL values on PHP 5.3.
|
32 |
-
*/
|
33 |
-
public function filter(OptionsInterface $options, $value)
|
34 |
-
{
|
35 |
-
if ($value instanceof ReplicationInterface) {
|
36 |
-
return $value;
|
37 |
-
}
|
38 |
-
|
39 |
-
if ($value === 'sentinel') {
|
40 |
-
return function ($sentinels, $options) {
|
41 |
-
return new SentinelReplication($options->service, $sentinels, $options->connections);
|
42 |
-
};
|
43 |
-
}
|
44 |
-
|
45 |
-
if (
|
46 |
-
!is_object($value) &&
|
47 |
-
null !== $asbool = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)
|
48 |
-
) {
|
49 |
-
if (true === $asbool) {
|
50 |
-
return $this->getDefault($options);
|
51 |
-
} else {
|
52 |
-
throw new \InvalidArgumentException(
|
53 |
-
"Values evaluating to FALSE are not accepted for `replication`"
|
54 |
-
);
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
throw new \InvalidArgumentException(
|
59 |
-
"An instance of type 'Predis\Connection\Aggregate\ReplicationInterface' was expected."
|
60 |
-
);
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* {@inheritdoc}
|
65 |
-
*/
|
66 |
-
public function getDefault(OptionsInterface $options)
|
67 |
-
{
|
68 |
-
$replication = new MasterSlaveReplication();
|
69 |
-
|
70 |
-
if ($options->autodiscovery) {
|
71 |
-
$replication->setConnectionFactory($options->connections);
|
72 |
-
$replication->setAutoDiscovery(true);
|
73 |
-
}
|
74 |
-
|
75 |
-
return $replication;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Connection/AbstractConnection.php
CHANGED
@@ -120,39 +120,16 @@ abstract class AbstractConnection implements NodeConnectionInterface
|
|
120 |
return $this->read();
|
121 |
}
|
122 |
|
123 |
-
/**
|
124 |
-
* Helper method that returns an exception message augmented with useful
|
125 |
-
* details from the connection parameters.
|
126 |
-
*
|
127 |
-
* @param string $message Error message.
|
128 |
-
*
|
129 |
-
* @return string
|
130 |
-
*/
|
131 |
-
private function createExceptionMessage($message)
|
132 |
-
{
|
133 |
-
$parameters = $this->parameters;
|
134 |
-
|
135 |
-
if ($parameters->scheme === 'unix') {
|
136 |
-
return "$message [$parameters->scheme:$parameters->path]";
|
137 |
-
}
|
138 |
-
|
139 |
-
if (filter_var($parameters->host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
140 |
-
return "$message [$parameters->scheme://[$parameters->host]:$parameters->port]";
|
141 |
-
}
|
142 |
-
|
143 |
-
return "$message [$parameters->scheme://$parameters->host:$parameters->port]";
|
144 |
-
}
|
145 |
-
|
146 |
/**
|
147 |
* Helper method to handle connection errors.
|
148 |
*
|
149 |
* @param string $message Error message.
|
150 |
* @param int $code Error code.
|
151 |
*/
|
152 |
-
protected function onConnectionError($message, $code =
|
153 |
{
|
154 |
CommunicationException::handle(
|
155 |
-
new ConnectionException($this,
|
156 |
);
|
157 |
}
|
158 |
|
@@ -164,7 +141,7 @@ abstract class AbstractConnection implements NodeConnectionInterface
|
|
164 |
protected function onProtocolError($message)
|
165 |
{
|
166 |
CommunicationException::handle(
|
167 |
-
new ProtocolException($this,
|
168 |
);
|
169 |
}
|
170 |
|
120 |
return $this->read();
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
/**
|
124 |
* Helper method to handle connection errors.
|
125 |
*
|
126 |
* @param string $message Error message.
|
127 |
* @param int $code Error code.
|
128 |
*/
|
129 |
+
protected function onConnectionError($message, $code = 0)
|
130 |
{
|
131 |
CommunicationException::handle(
|
132 |
+
new ConnectionException($this, "$message [{$this->getParameters()}]", $code)
|
133 |
);
|
134 |
}
|
135 |
|
141 |
protected function onProtocolError($message)
|
142 |
{
|
143 |
CommunicationException::handle(
|
144 |
+
new ProtocolException($this, "$message [{$this->getParameters()}]")
|
145 |
);
|
146 |
}
|
147 |
|
dependencies/predis/predis/src/Connection/AggregateConnectionInterface.php
CHANGED
@@ -44,7 +44,7 @@ interface AggregateConnectionInterface extends ConnectionInterface
|
|
44 |
*
|
45 |
* @return NodeConnectionInterface
|
46 |
*/
|
47 |
-
public function
|
48 |
|
49 |
/**
|
50 |
* Returns a connection instance from the aggregate connection by its alias.
|
44 |
*
|
45 |
* @return NodeConnectionInterface
|
46 |
*/
|
47 |
+
public function getConnectionByCommand(CommandInterface $command);
|
48 |
|
49 |
/**
|
50 |
* Returns a connection instance from the aggregate connection by its alias.
|
dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/ClusterInterface.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\Connection\AggregateConnectionInterface;
|
15 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Cluster;
|
13 |
|
14 |
use Predis\Connection\AggregateConnectionInterface;
|
15 |
|
dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/PredisCluster.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\Cluster\PredisStrategy;
|
15 |
use Predis\Cluster\StrategyInterface;
|
@@ -27,8 +27,24 @@ use Predis\NotSupportedException;
|
|
27 |
*/
|
28 |
class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
29 |
{
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
private $strategy;
|
|
|
|
|
|
|
|
|
32 |
private $distributor;
|
33 |
|
34 |
/**
|
@@ -36,7 +52,6 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
36 |
*/
|
37 |
public function __construct(StrategyInterface $strategy = null)
|
38 |
{
|
39 |
-
$this->pool = array();
|
40 |
$this->strategy = $strategy ?: new PredisStrategy();
|
41 |
$this->distributor = $this->strategy->getDistributor();
|
42 |
}
|
@@ -82,14 +97,13 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
82 |
{
|
83 |
$parameters = $connection->getParameters();
|
84 |
|
|
|
|
|
85 |
if (isset($parameters->alias)) {
|
86 |
-
$this->
|
87 |
-
} else {
|
88 |
-
$this->pool[] = $connection;
|
89 |
}
|
90 |
|
91 |
-
$
|
92 |
-
$this->distributor->add($connection, $weight);
|
93 |
}
|
94 |
|
95 |
/**
|
@@ -97,27 +111,15 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
97 |
*/
|
98 |
public function remove(NodeConnectionInterface $connection)
|
99 |
{
|
100 |
-
if (
|
101 |
unset($this->pool[$id]);
|
102 |
$this->distributor->remove($connection);
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
return false;
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
* Removes a connection instance using its alias or index.
|
112 |
-
*
|
113 |
-
* @param string $connectionID Alias or index of a connection.
|
114 |
-
*
|
115 |
-
* @return bool Returns true if the connection was in the pool.
|
116 |
-
*/
|
117 |
-
public function removeById($connectionID)
|
118 |
-
{
|
119 |
-
if ($connection = $this->getConnectionById($connectionID)) {
|
120 |
-
return $this->remove($connection);
|
121 |
}
|
122 |
|
123 |
return false;
|
@@ -126,7 +128,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
126 |
/**
|
127 |
* {@inheritdoc}
|
128 |
*/
|
129 |
-
public function
|
130 |
{
|
131 |
$slot = $this->strategy->getSlot($command);
|
132 |
|
@@ -136,17 +138,43 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
136 |
);
|
137 |
}
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
return $node;
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
* {@inheritdoc}
|
146 |
*/
|
147 |
-
public function getConnectionById($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
{
|
149 |
-
return
|
150 |
}
|
151 |
|
152 |
/**
|
@@ -159,9 +187,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
159 |
public function getConnectionByKey($key)
|
160 |
{
|
161 |
$hash = $this->strategy->getSlotByKey($key);
|
162 |
-
|
163 |
-
|
164 |
-
return $node;
|
165 |
}
|
166 |
|
167 |
/**
|
@@ -176,7 +202,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
-
* @
|
180 |
*/
|
181 |
#[\ReturnTypeWillChange]
|
182 |
public function count()
|
@@ -185,7 +211,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
185 |
}
|
186 |
|
187 |
/**
|
188 |
-
* @
|
189 |
*/
|
190 |
#[\ReturnTypeWillChange]
|
191 |
public function getIterator()
|
@@ -198,7 +224,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
198 |
*/
|
199 |
public function writeRequest(CommandInterface $command)
|
200 |
{
|
201 |
-
$this->
|
202 |
}
|
203 |
|
204 |
/**
|
@@ -206,7 +232,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
206 |
*/
|
207 |
public function readResponse(CommandInterface $command)
|
208 |
{
|
209 |
-
return $this->
|
210 |
}
|
211 |
|
212 |
/**
|
@@ -214,24 +240,6 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
214 |
*/
|
215 |
public function executeCommand(CommandInterface $command)
|
216 |
{
|
217 |
-
return $this->
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Executes the specified Redis command on all the nodes of a cluster.
|
222 |
-
*
|
223 |
-
* @param CommandInterface $command A Redis command.
|
224 |
-
*
|
225 |
-
* @return array
|
226 |
-
*/
|
227 |
-
public function executeCommandOnNodes(CommandInterface $command)
|
228 |
-
{
|
229 |
-
$responses = array();
|
230 |
-
|
231 |
-
foreach ($this->pool as $connection) {
|
232 |
-
$responses[] = $connection->executeCommand($command);
|
233 |
-
}
|
234 |
-
|
235 |
-
return $responses;
|
236 |
}
|
237 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Cluster;
|
13 |
|
14 |
use Predis\Cluster\PredisStrategy;
|
15 |
use Predis\Cluster\StrategyInterface;
|
27 |
*/
|
28 |
class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
29 |
{
|
30 |
+
/**
|
31 |
+
* @var NodeConnectionInterface[]
|
32 |
+
*/
|
33 |
+
private $pool = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var NodeConnectionInterface[]
|
37 |
+
*/
|
38 |
+
private $aliases = array();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @var StrategyInterface
|
42 |
+
*/
|
43 |
private $strategy;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @var Predis\Cluster\Distributor\DistributorInterface
|
47 |
+
*/
|
48 |
private $distributor;
|
49 |
|
50 |
/**
|
52 |
*/
|
53 |
public function __construct(StrategyInterface $strategy = null)
|
54 |
{
|
|
|
55 |
$this->strategy = $strategy ?: new PredisStrategy();
|
56 |
$this->distributor = $this->strategy->getDistributor();
|
57 |
}
|
97 |
{
|
98 |
$parameters = $connection->getParameters();
|
99 |
|
100 |
+
$this->pool[(string) $connection] = $connection;
|
101 |
+
|
102 |
if (isset($parameters->alias)) {
|
103 |
+
$this->aliases[$parameters->alias] = $connection;
|
|
|
|
|
104 |
}
|
105 |
|
106 |
+
$this->distributor->add($connection, $parameters->weight);
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
111 |
*/
|
112 |
public function remove(NodeConnectionInterface $connection)
|
113 |
{
|
114 |
+
if (false !== $id = array_search($connection, $this->pool, true)) {
|
115 |
unset($this->pool[$id]);
|
116 |
$this->distributor->remove($connection);
|
117 |
|
118 |
+
if ($this->aliases && $alias = $connection->getParameters()->alias) {
|
119 |
+
unset($this->aliases[$alias]);
|
120 |
+
}
|
|
|
|
|
121 |
|
122 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
return false;
|
128 |
/**
|
129 |
* {@inheritdoc}
|
130 |
*/
|
131 |
+
public function getConnectionByCommand(CommandInterface $command)
|
132 |
{
|
133 |
$slot = $this->strategy->getSlot($command);
|
134 |
|
138 |
);
|
139 |
}
|
140 |
|
141 |
+
return $this->distributor->getBySlot($slot);
|
|
|
|
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
* {@inheritdoc}
|
146 |
*/
|
147 |
+
public function getConnectionById($id)
|
148 |
+
{
|
149 |
+
if (isset($this->pool[$id])) {
|
150 |
+
return $this->pool[$id];
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Returns a connection instance by its alias.
|
156 |
+
*
|
157 |
+
* @param string $alias Connection alias.
|
158 |
+
*
|
159 |
+
* @return NodeConnectionInterface|null
|
160 |
+
*/
|
161 |
+
public function getConnectionByAlias($alias)
|
162 |
+
{
|
163 |
+
if (isset($this->aliases[$alias])) {
|
164 |
+
return $this->aliases[$alias];
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Retrieves a connection instance by slot.
|
170 |
+
*
|
171 |
+
* @param string $key Key string.
|
172 |
+
*
|
173 |
+
* @return NodeConnectionInterface|null
|
174 |
+
*/
|
175 |
+
public function getConnectionBySlot($slot)
|
176 |
{
|
177 |
+
return $this->distributor->getBySlot($slot);
|
178 |
}
|
179 |
|
180 |
/**
|
187 |
public function getConnectionByKey($key)
|
188 |
{
|
189 |
$hash = $this->strategy->getSlotByKey($key);
|
190 |
+
return $this->distributor->getBySlot($hash);
|
|
|
|
|
191 |
}
|
192 |
|
193 |
/**
|
202 |
}
|
203 |
|
204 |
/**
|
205 |
+
* {@inheritdoc}
|
206 |
*/
|
207 |
#[\ReturnTypeWillChange]
|
208 |
public function count()
|
211 |
}
|
212 |
|
213 |
/**
|
214 |
+
* {@inheritdoc}
|
215 |
*/
|
216 |
#[\ReturnTypeWillChange]
|
217 |
public function getIterator()
|
224 |
*/
|
225 |
public function writeRequest(CommandInterface $command)
|
226 |
{
|
227 |
+
$this->getConnectionByCommand($command)->writeRequest($command);
|
228 |
}
|
229 |
|
230 |
/**
|
232 |
*/
|
233 |
public function readResponse(CommandInterface $command)
|
234 |
{
|
235 |
+
return $this->getConnectionByCommand($command)->readResponse($command);
|
236 |
}
|
237 |
|
238 |
/**
|
240 |
*/
|
241 |
public function executeCommand(CommandInterface $command)
|
242 |
{
|
243 |
+
return $this->getConnectionByCommand($command)->executeCommand($command);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
}
|
dependencies/predis/predis/src/Connection/{Aggregate → Cluster}/RedisCluster.php
RENAMED
@@ -9,10 +9,11 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\ClientException;
|
15 |
use Predis\Cluster\RedisStrategy as RedisClusterStrategy;
|
|
|
16 |
use Predis\Cluster\StrategyInterface;
|
17 |
use Predis\Command\CommandInterface;
|
18 |
use Predis\Command\RawCommand;
|
@@ -49,7 +50,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
49 |
private $useClusterSlots = true;
|
50 |
private $pool = array();
|
51 |
private $slots = array();
|
52 |
-
private $
|
53 |
private $strategy;
|
54 |
private $connections;
|
55 |
private $retryLimit = 5;
|
@@ -64,6 +65,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
64 |
) {
|
65 |
$this->connections = $connections;
|
66 |
$this->strategy = $strategy ?: new RedisClusterStrategy();
|
|
|
67 |
}
|
68 |
|
69 |
/**
|
@@ -120,7 +122,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
120 |
public function add(NodeConnectionInterface $connection)
|
121 |
{
|
122 |
$this->pool[(string) $connection] = $connection;
|
123 |
-
|
124 |
}
|
125 |
|
126 |
/**
|
@@ -129,12 +131,9 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
129 |
public function remove(NodeConnectionInterface $connection)
|
130 |
{
|
131 |
if (false !== $id = array_search($connection, $this->pool, true)) {
|
132 |
-
|
133 |
-
$this->pool[$id],
|
134 |
-
$this->slotsMap
|
135 |
-
);
|
136 |
-
|
137 |
$this->slots = array_diff($this->slots, array($connection));
|
|
|
138 |
|
139 |
return true;
|
140 |
}
|
@@ -152,10 +151,9 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
152 |
public function removeById($connectionID)
|
153 |
{
|
154 |
if (isset($this->pool[$connectionID])) {
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
);
|
159 |
|
160 |
return true;
|
161 |
}
|
@@ -171,12 +169,10 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
171 |
* cluster, so it is most effective when all of the connections supplied on
|
172 |
* initialization have the "slots" parameter properly set accordingly to the
|
173 |
* current cluster configuration.
|
174 |
-
*
|
175 |
-
* @return array
|
176 |
*/
|
177 |
-
public function
|
178 |
{
|
179 |
-
$this->
|
180 |
|
181 |
foreach ($this->pool as $connectionID => $connection) {
|
182 |
$parameters = $connection->getParameters();
|
@@ -192,11 +188,9 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
192 |
$slots[1] = $slots[0];
|
193 |
}
|
194 |
|
195 |
-
$this->setSlots($slots[0], $slots[1], $connectionID);
|
196 |
}
|
197 |
}
|
198 |
-
|
199 |
-
return $this->slotsMap;
|
200 |
}
|
201 |
|
202 |
/**
|
@@ -210,7 +204,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
210 |
*
|
211 |
* @return mixed
|
212 |
*/
|
213 |
-
private function
|
214 |
{
|
215 |
$retries = 0;
|
216 |
$command = RawCommand::create('CLUSTER', 'SLOTS');
|
@@ -246,18 +240,16 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
246 |
* the pool.
|
247 |
*
|
248 |
* @param NodeConnectionInterface $connection Optional connection instance.
|
249 |
-
*
|
250 |
-
* @return array
|
251 |
*/
|
252 |
-
public function
|
253 |
{
|
254 |
if (!$connection && !$connection = $this->getRandomConnection()) {
|
255 |
-
return
|
256 |
}
|
257 |
|
258 |
-
$this->
|
259 |
|
260 |
-
$response = $this->
|
261 |
|
262 |
foreach ($response as $slots) {
|
263 |
// We only support master servers for now, so we ignore subsequent
|
@@ -265,61 +257,11 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
265 |
list($start, $end, $master) = $slots;
|
266 |
|
267 |
if ($master[0] === '') {
|
268 |
-
$this->setSlots($start, $end, (string) $connection);
|
269 |
} else {
|
270 |
-
$this->setSlots($start, $end, "{$master[0]}:{$master[1]}");
|
271 |
}
|
272 |
}
|
273 |
-
|
274 |
-
return $this->slotsMap;
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Resets the slots map cache.
|
279 |
-
*/
|
280 |
-
public function resetSlotsMap()
|
281 |
-
{
|
282 |
-
$this->slotsMap = array();
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Returns the current slots map for the cluster.
|
287 |
-
*
|
288 |
-
* The order of the returned $slot => $server dictionary is not guaranteed.
|
289 |
-
*
|
290 |
-
* @return array
|
291 |
-
*/
|
292 |
-
public function getSlotsMap()
|
293 |
-
{
|
294 |
-
if (!isset($this->slotsMap)) {
|
295 |
-
$this->slotsMap = array();
|
296 |
-
}
|
297 |
-
|
298 |
-
return $this->slotsMap;
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Pre-associates a connection to a slots range to avoid runtime guessing.
|
303 |
-
*
|
304 |
-
* @param int $first Initial slot of the range.
|
305 |
-
* @param int $last Last slot of the range.
|
306 |
-
* @param NodeConnectionInterface|string $connection ID or connection instance.
|
307 |
-
*
|
308 |
-
* @throws \OutOfBoundsException
|
309 |
-
*/
|
310 |
-
public function setSlots($first, $last, $connection)
|
311 |
-
{
|
312 |
-
if ($first < 0x0000 || $first > 0x3FFF ||
|
313 |
-
$last < 0x0000 || $last > 0x3FFF ||
|
314 |
-
$last < $first
|
315 |
-
) {
|
316 |
-
throw new \OutOfBoundsException(
|
317 |
-
"Invalid slot range for $connection: [$first-$last]."
|
318 |
-
);
|
319 |
-
}
|
320 |
-
|
321 |
-
$slots = array_fill($first, $last - $first + 1, (string) $connection);
|
322 |
-
$this->slotsMap = $this->getSlotsMap() + $slots;
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -337,12 +279,12 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
337 |
throw new ClientException('No connections available in the pool');
|
338 |
}
|
339 |
|
340 |
-
if (
|
341 |
-
$this->
|
342 |
}
|
343 |
|
344 |
-
if (
|
345 |
-
return $
|
346 |
}
|
347 |
|
348 |
$count = count($this->pool);
|
@@ -372,7 +314,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
372 |
/**
|
373 |
* {@inheritdoc}
|
374 |
*/
|
375 |
-
public function
|
376 |
{
|
377 |
$slot = $this->strategy->getSlot($command);
|
378 |
|
@@ -400,7 +342,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
400 |
*/
|
401 |
public function getConnectionBySlot($slot)
|
402 |
{
|
403 |
-
if ($slot
|
404 |
throw new \OutOfBoundsException("Invalid slot [$slot].");
|
405 |
}
|
406 |
|
@@ -451,6 +393,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
451 |
{
|
452 |
$this->pool[(string) $connection] = $connection;
|
453 |
$this->slots[(int) $slot] = $connection;
|
|
|
454 |
}
|
455 |
|
456 |
/**
|
@@ -495,13 +438,11 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
495 |
}
|
496 |
|
497 |
if ($this->useClusterSlots) {
|
498 |
-
$this->
|
499 |
}
|
500 |
|
501 |
$this->move($connection, $slot);
|
502 |
-
|
503 |
-
|
504 |
-
return $response;
|
505 |
}
|
506 |
|
507 |
/**
|
@@ -522,9 +463,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
522 |
}
|
523 |
|
524 |
$connection->executeCommand(RawCommand::create('ASKING'));
|
525 |
-
|
526 |
-
|
527 |
-
return $response;
|
528 |
}
|
529 |
|
530 |
/**
|
@@ -547,7 +486,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
547 |
|
548 |
RETRY_COMMAND: {
|
549 |
try {
|
550 |
-
$response = $this->
|
551 |
} catch (ConnectionException $exception) {
|
552 |
$connection = $exception->getConnection();
|
553 |
$connection->disconnect();
|
@@ -557,7 +496,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
557 |
if ($failure) {
|
558 |
throw $exception;
|
559 |
} elseif ($this->useClusterSlots) {
|
560 |
-
$this->
|
561 |
}
|
562 |
|
563 |
$failure = true;
|
@@ -600,7 +539,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
600 |
}
|
601 |
|
602 |
/**
|
603 |
-
* @
|
604 |
*/
|
605 |
#[\ReturnTypeWillChange]
|
606 |
public function count()
|
@@ -609,20 +548,18 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
609 |
}
|
610 |
|
611 |
/**
|
612 |
-
* @
|
613 |
*/
|
614 |
#[\ReturnTypeWillChange]
|
615 |
public function getIterator()
|
616 |
{
|
617 |
-
if ($this->
|
618 |
-
$
|
619 |
-
} else {
|
620 |
-
$slotsmap = $this->getSlotsMap() ?: $this->buildSlotsMap();
|
621 |
}
|
622 |
|
623 |
$connections = array();
|
624 |
|
625 |
-
foreach (
|
626 |
if (!$connection = $this->getConnectionById($node)) {
|
627 |
$this->add($connection = $this->createConnection($node));
|
628 |
}
|
@@ -633,6 +570,16 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
633 |
return new \ArrayIterator($connections);
|
634 |
}
|
635 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
/**
|
637 |
* Returns the underlying command hash strategy used to hash commands by
|
638 |
* using keys found in their arguments.
|
@@ -663,7 +610,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
|
663 |
* procedure, mostly when targeting many keys that would end up in a lot of
|
664 |
* redirections.
|
665 |
*
|
666 |
-
* The slots map can still be manually fetched using the
|
667 |
* method whether or not this option is enabled.
|
668 |
*
|
669 |
* @param bool $value Enable or disable the use of CLUSTER SLOTS.
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Cluster;
|
13 |
|
14 |
use Predis\ClientException;
|
15 |
use Predis\Cluster\RedisStrategy as RedisClusterStrategy;
|
16 |
+
use Predis\Cluster\SlotMap;
|
17 |
use Predis\Cluster\StrategyInterface;
|
18 |
use Predis\Command\CommandInterface;
|
19 |
use Predis\Command\RawCommand;
|
50 |
private $useClusterSlots = true;
|
51 |
private $pool = array();
|
52 |
private $slots = array();
|
53 |
+
private $slotmap;
|
54 |
private $strategy;
|
55 |
private $connections;
|
56 |
private $retryLimit = 5;
|
65 |
) {
|
66 |
$this->connections = $connections;
|
67 |
$this->strategy = $strategy ?: new RedisClusterStrategy();
|
68 |
+
$this->slotmap = new SlotMap();
|
69 |
}
|
70 |
|
71 |
/**
|
122 |
public function add(NodeConnectionInterface $connection)
|
123 |
{
|
124 |
$this->pool[(string) $connection] = $connection;
|
125 |
+
$this->slotmap->reset();
|
126 |
}
|
127 |
|
128 |
/**
|
131 |
public function remove(NodeConnectionInterface $connection)
|
132 |
{
|
133 |
if (false !== $id = array_search($connection, $this->pool, true)) {
|
134 |
+
$this->slotmap->reset();
|
|
|
|
|
|
|
|
|
135 |
$this->slots = array_diff($this->slots, array($connection));
|
136 |
+
unset($this->pool[$id]);
|
137 |
|
138 |
return true;
|
139 |
}
|
151 |
public function removeById($connectionID)
|
152 |
{
|
153 |
if (isset($this->pool[$connectionID])) {
|
154 |
+
$this->slotmap->reset();
|
155 |
+
$this->slots = array_diff($this->slots, array($connectionID));
|
156 |
+
unset($this->pool[$connectionID]);
|
|
|
157 |
|
158 |
return true;
|
159 |
}
|
169 |
* cluster, so it is most effective when all of the connections supplied on
|
170 |
* initialization have the "slots" parameter properly set accordingly to the
|
171 |
* current cluster configuration.
|
|
|
|
|
172 |
*/
|
173 |
+
public function buildSlotMap()
|
174 |
{
|
175 |
+
$this->slotmap->reset();
|
176 |
|
177 |
foreach ($this->pool as $connectionID => $connection) {
|
178 |
$parameters = $connection->getParameters();
|
188 |
$slots[1] = $slots[0];
|
189 |
}
|
190 |
|
191 |
+
$this->slotmap->setSlots($slots[0], $slots[1], $connectionID);
|
192 |
}
|
193 |
}
|
|
|
|
|
194 |
}
|
195 |
|
196 |
/**
|
204 |
*
|
205 |
* @return mixed
|
206 |
*/
|
207 |
+
private function queryClusterNodeForSlotMap(NodeConnectionInterface $connection)
|
208 |
{
|
209 |
$retries = 0;
|
210 |
$command = RawCommand::create('CLUSTER', 'SLOTS');
|
240 |
* the pool.
|
241 |
*
|
242 |
* @param NodeConnectionInterface $connection Optional connection instance.
|
|
|
|
|
243 |
*/
|
244 |
+
public function askSlotMap(NodeConnectionInterface $connection = null)
|
245 |
{
|
246 |
if (!$connection && !$connection = $this->getRandomConnection()) {
|
247 |
+
return;
|
248 |
}
|
249 |
|
250 |
+
$this->slotmap->reset();
|
251 |
|
252 |
+
$response = $this->queryClusterNodeForSlotMap($connection);
|
253 |
|
254 |
foreach ($response as $slots) {
|
255 |
// We only support master servers for now, so we ignore subsequent
|
257 |
list($start, $end, $master) = $slots;
|
258 |
|
259 |
if ($master[0] === '') {
|
260 |
+
$this->slotmap->setSlots($start, $end, (string) $connection);
|
261 |
} else {
|
262 |
+
$this->slotmap->setSlots($start, $end, "{$master[0]}:{$master[1]}");
|
263 |
}
|
264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
/**
|
279 |
throw new ClientException('No connections available in the pool');
|
280 |
}
|
281 |
|
282 |
+
if ($this->slotmap->isEmpty()) {
|
283 |
+
$this->buildSlotMap();
|
284 |
}
|
285 |
|
286 |
+
if ($node = $this->slotmap[$slot]) {
|
287 |
+
return $node;
|
288 |
}
|
289 |
|
290 |
$count = count($this->pool);
|
314 |
/**
|
315 |
* {@inheritdoc}
|
316 |
*/
|
317 |
+
public function getConnectionByCommand(CommandInterface $command)
|
318 |
{
|
319 |
$slot = $this->strategy->getSlot($command);
|
320 |
|
342 |
*/
|
343 |
public function getConnectionBySlot($slot)
|
344 |
{
|
345 |
+
if (!SlotMap::isValid($slot)) {
|
346 |
throw new \OutOfBoundsException("Invalid slot [$slot].");
|
347 |
}
|
348 |
|
393 |
{
|
394 |
$this->pool[(string) $connection] = $connection;
|
395 |
$this->slots[(int) $slot] = $connection;
|
396 |
+
$this->slotmap[(int) $slot] = $connection;
|
397 |
}
|
398 |
|
399 |
/**
|
438 |
}
|
439 |
|
440 |
if ($this->useClusterSlots) {
|
441 |
+
$this->askSlotMap($connection);
|
442 |
}
|
443 |
|
444 |
$this->move($connection, $slot);
|
445 |
+
return $this->executeCommand($command);
|
|
|
|
|
446 |
}
|
447 |
|
448 |
/**
|
463 |
}
|
464 |
|
465 |
$connection->executeCommand(RawCommand::create('ASKING'));
|
466 |
+
return $connection->executeCommand($command);
|
|
|
|
|
467 |
}
|
468 |
|
469 |
/**
|
486 |
|
487 |
RETRY_COMMAND: {
|
488 |
try {
|
489 |
+
$response = $this->getConnectionByCommand($command)->$method($command);
|
490 |
} catch (ConnectionException $exception) {
|
491 |
$connection = $exception->getConnection();
|
492 |
$connection->disconnect();
|
496 |
if ($failure) {
|
497 |
throw $exception;
|
498 |
} elseif ($this->useClusterSlots) {
|
499 |
+
$this->askSlotMap();
|
500 |
}
|
501 |
|
502 |
$failure = true;
|
539 |
}
|
540 |
|
541 |
/**
|
542 |
+
* {@inheritdoc}
|
543 |
*/
|
544 |
#[\ReturnTypeWillChange]
|
545 |
public function count()
|
548 |
}
|
549 |
|
550 |
/**
|
551 |
+
* {@inheritdoc}
|
552 |
*/
|
553 |
#[\ReturnTypeWillChange]
|
554 |
public function getIterator()
|
555 |
{
|
556 |
+
if ($this->slotmap->isEmpty()) {
|
557 |
+
$this->useClusterSlots ? $this->askSlotMap() : $this->buildSlotMap();
|
|
|
|
|
558 |
}
|
559 |
|
560 |
$connections = array();
|
561 |
|
562 |
+
foreach ($this->slotmap->getNodes() as $node) {
|
563 |
if (!$connection = $this->getConnectionById($node)) {
|
564 |
$this->add($connection = $this->createConnection($node));
|
565 |
}
|
570 |
return new \ArrayIterator($connections);
|
571 |
}
|
572 |
|
573 |
+
/**
|
574 |
+
* Returns the underlying slot map.
|
575 |
+
*
|
576 |
+
* @return SlotMap
|
577 |
+
*/
|
578 |
+
public function getSlotMap()
|
579 |
+
{
|
580 |
+
return $this->slotmap;
|
581 |
+
}
|
582 |
+
|
583 |
/**
|
584 |
* Returns the underlying command hash strategy used to hash commands by
|
585 |
* using keys found in their arguments.
|
610 |
* procedure, mostly when targeting many keys that would end up in a lot of
|
611 |
* redirections.
|
612 |
*
|
613 |
+
* The slots map can still be manually fetched using the askSlotMap()
|
614 |
* method whether or not this option is enabled.
|
615 |
*
|
616 |
* @param bool $value Enable or disable the use of CLUSTER SLOTS.
|
dependencies/predis/predis/src/Connection/Factory.php
CHANGED
@@ -109,16 +109,6 @@ class Factory implements FactoryInterface
|
|
109 |
return $connection;
|
110 |
}
|
111 |
|
112 |
-
/**
|
113 |
-
* {@inheritdoc}
|
114 |
-
*/
|
115 |
-
public function aggregate(AggregateConnectionInterface $connection, array $parameters)
|
116 |
-
{
|
117 |
-
foreach ($parameters as $node) {
|
118 |
-
$connection->add($node instanceof NodeConnectionInterface ? $node : $this->create($node));
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
/**
|
123 |
* Assigns a default set of parameters applied to new connections.
|
124 |
*
|
@@ -175,17 +165,17 @@ class Factory implements FactoryInterface
|
|
175 |
|
176 |
if (isset($parameters->password) && strlen($parameters->password)) {
|
177 |
$cmdAuthArgs = isset($parameters->username) && strlen($parameters->username)
|
178 |
-
? array(
|
179 |
-
: array(
|
180 |
|
181 |
$connection->addConnectCommand(
|
182 |
-
new RawCommand($cmdAuthArgs)
|
183 |
);
|
184 |
}
|
185 |
|
186 |
if (isset($parameters->database) && strlen($parameters->database)) {
|
187 |
$connection->addConnectCommand(
|
188 |
-
new RawCommand(
|
189 |
);
|
190 |
}
|
191 |
}
|
109 |
return $connection;
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
/**
|
113 |
* Assigns a default set of parameters applied to new connections.
|
114 |
*
|
165 |
|
166 |
if (isset($parameters->password) && strlen($parameters->password)) {
|
167 |
$cmdAuthArgs = isset($parameters->username) && strlen($parameters->username)
|
168 |
+
? array($parameters->username, $parameters->password)
|
169 |
+
: array($parameters->password);
|
170 |
|
171 |
$connection->addConnectCommand(
|
172 |
+
new RawCommand('AUTH', $cmdAuthArgs)
|
173 |
);
|
174 |
}
|
175 |
|
176 |
if (isset($parameters->database) && strlen($parameters->database)) {
|
177 |
$connection->addConnectCommand(
|
178 |
+
new RawCommand('SELECT', array($parameters->database))
|
179 |
);
|
180 |
}
|
181 |
}
|
dependencies/predis/predis/src/Connection/FactoryInterface.php
CHANGED
@@ -41,12 +41,4 @@ interface FactoryInterface
|
|
41 |
* @return NodeConnectionInterface
|
42 |
*/
|
43 |
public function create($parameters);
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Aggregates single connections into an aggregate connection instance.
|
47 |
-
*
|
48 |
-
* @param AggregateConnectionInterface $aggregate Aggregate connection instance.
|
49 |
-
* @param array $parameters List of parameters for each connection.
|
50 |
-
*/
|
51 |
-
public function aggregate(AggregateConnectionInterface $aggregate, array $parameters);
|
52 |
}
|
41 |
* @return NodeConnectionInterface
|
42 |
*/
|
43 |
public function create($parameters);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
dependencies/predis/predis/src/Connection/Parameters.php
CHANGED
@@ -20,9 +20,7 @@ namespace Predis\Connection;
|
|
20 |
*/
|
21 |
class Parameters implements ParametersInterface
|
22 |
{
|
23 |
-
|
24 |
-
|
25 |
-
private static $defaults = array(
|
26 |
'scheme' => 'tcp',
|
27 |
'host' => '127.0.0.1',
|
28 |
'port' => 6379,
|
@@ -33,17 +31,21 @@ class Parameters implements ParametersInterface
|
|
33 |
*/
|
34 |
public function __construct(array $parameters = array())
|
35 |
{
|
36 |
-
$this->parameters = $this->filter($parameters
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
-
*
|
|
|
|
|
41 |
*
|
42 |
* @return array
|
43 |
*/
|
44 |
-
protected function
|
45 |
{
|
46 |
-
return
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -138,15 +140,11 @@ class Parameters implements ParametersInterface
|
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
-
*
|
142 |
-
*
|
143 |
-
* @param array $parameters Connection parameters.
|
144 |
-
*
|
145 |
-
* @return array
|
146 |
*/
|
147 |
-
|
148 |
{
|
149 |
-
return $parameters
|
150 |
}
|
151 |
|
152 |
/**
|
@@ -170,9 +168,17 @@ class Parameters implements ParametersInterface
|
|
170 |
/**
|
171 |
* {@inheritdoc}
|
172 |
*/
|
173 |
-
public function
|
174 |
{
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
|
178 |
/**
|
20 |
*/
|
21 |
class Parameters implements ParametersInterface
|
22 |
{
|
23 |
+
protected static $defaults = array(
|
|
|
|
|
24 |
'scheme' => 'tcp',
|
25 |
'host' => '127.0.0.1',
|
26 |
'port' => 6379,
|
31 |
*/
|
32 |
public function __construct(array $parameters = array())
|
33 |
{
|
34 |
+
$this->parameters = $this->filter($parameters + static::$defaults);
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
+
* Filters parameters removing entries with NULL or 0-length string values.
|
39 |
+
*
|
40 |
+
* @params array $parameters Array of parameters to be filtered
|
41 |
*
|
42 |
* @return array
|
43 |
*/
|
44 |
+
protected function filter(array $parameters)
|
45 |
{
|
46 |
+
return array_filter($parameters, function ($value) {
|
47 |
+
return $value !== null && $value !== '';
|
48 |
+
});
|
49 |
}
|
50 |
|
51 |
/**
|
140 |
}
|
141 |
|
142 |
/**
|
143 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
144 |
*/
|
145 |
+
public function toArray()
|
146 |
{
|
147 |
+
return $this->parameters;
|
148 |
}
|
149 |
|
150 |
/**
|
168 |
/**
|
169 |
* {@inheritdoc}
|
170 |
*/
|
171 |
+
public function __toString()
|
172 |
{
|
173 |
+
if ($this->scheme === 'unix') {
|
174 |
+
return "$this->scheme:$this->path";
|
175 |
+
}
|
176 |
+
|
177 |
+
if (filter_var($this->host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
178 |
+
return "$this->scheme://[$this->host]:$this->port";
|
179 |
+
}
|
180 |
+
|
181 |
+
return "$this->scheme://$this->host:$this->port";
|
182 |
}
|
183 |
|
184 |
/**
|
dependencies/predis/predis/src/Connection/ParametersInterface.php
CHANGED
@@ -53,6 +53,13 @@ interface ParametersInterface
|
|
53 |
*/
|
54 |
public function __get($parameter);
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* Returns an array representation of the connection parameters.
|
58 |
*
|
53 |
*/
|
54 |
public function __get($parameter);
|
55 |
|
56 |
+
/**
|
57 |
+
* Returns basic connection parameters as a valid URI string.
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function __toString();
|
62 |
+
|
63 |
/**
|
64 |
* Returns an array representation of the connection parameters.
|
65 |
*
|
dependencies/predis/predis/src/Connection/PhpiredisStreamConnection.php
CHANGED
@@ -119,14 +119,13 @@ class PhpiredisStreamConnection extends StreamConnection
|
|
119 |
/**
|
120 |
* {@inheritdoc}
|
121 |
*/
|
122 |
-
protected function createStreamSocket(ParametersInterface $parameters, $address, $flags
|
123 |
{
|
124 |
$socket = null;
|
125 |
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
|
|
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
if (!$resource) {
|
130 |
$this->onConnectionError(trim($errstr), $errno);
|
131 |
}
|
132 |
|
119 |
/**
|
120 |
* {@inheritdoc}
|
121 |
*/
|
122 |
+
protected function createStreamSocket(ParametersInterface $parameters, $address, $flags)
|
123 |
{
|
124 |
$socket = null;
|
125 |
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
|
126 |
+
$context = stream_context_create(['socket' => ['tcp_nodelay' => (bool) $parameters->tcp_nodelay]]);
|
127 |
|
128 |
+
if (!$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags, $context)) {
|
|
|
|
|
129 |
$this->onConnectionError(trim($errstr), $errno);
|
130 |
}
|
131 |
|
dependencies/predis/predis/src/Connection/{Aggregate → Replication}/MasterSlaveReplication.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\ClientException;
|
15 |
use Predis\Command\CommandInterface;
|
@@ -44,6 +44,16 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
44 |
*/
|
45 |
protected $slaves = array();
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* @var NodeConnectionInterface
|
49 |
*/
|
@@ -105,14 +115,21 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
105 |
*/
|
106 |
public function add(NodeConnectionInterface $connection)
|
107 |
{
|
108 |
-
$
|
109 |
|
110 |
-
if (
|
111 |
$this->master = $connection;
|
112 |
} else {
|
113 |
-
|
|
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
$this->reset();
|
117 |
}
|
118 |
|
@@ -121,27 +138,29 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
121 |
*/
|
122 |
public function remove(NodeConnectionInterface $connection)
|
123 |
{
|
124 |
-
if ($connection
|
125 |
$this->master = null;
|
126 |
-
|
127 |
-
|
128 |
-
return true;
|
129 |
} else {
|
130 |
-
|
131 |
-
|
132 |
-
$this->reset();
|
133 |
|
134 |
-
|
135 |
-
|
|
|
|
|
136 |
}
|
137 |
|
138 |
-
|
|
|
|
|
139 |
}
|
140 |
|
141 |
/**
|
142 |
* {@inheritdoc}
|
143 |
*/
|
144 |
-
public function
|
145 |
{
|
146 |
if (!$this->current) {
|
147 |
if ($this->strategy->isReadOperation($command) && $slave = $this->pickSlave()) {
|
@@ -167,30 +186,52 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
167 |
/**
|
168 |
* {@inheritdoc}
|
169 |
*/
|
170 |
-
public function getConnectionById($
|
171 |
{
|
172 |
-
if ($
|
173 |
-
return $this->
|
174 |
}
|
|
|
175 |
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
-
|
180 |
-
return;
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
-
*
|
|
|
|
|
|
|
|
|
185 |
*/
|
186 |
-
public function
|
187 |
{
|
188 |
-
if (
|
189 |
-
|
|
|
|
|
190 |
}
|
|
|
191 |
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
|
196 |
if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
|
@@ -201,19 +242,26 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
201 |
}
|
202 |
|
203 |
/**
|
204 |
-
*
|
205 |
*/
|
206 |
public function switchToMaster()
|
207 |
{
|
208 |
-
$this->
|
|
|
|
|
|
|
|
|
209 |
}
|
210 |
|
211 |
/**
|
212 |
-
*
|
213 |
*/
|
214 |
public function switchToSlave()
|
215 |
{
|
216 |
-
|
|
|
|
|
|
|
217 |
$this->switchTo($connection);
|
218 |
}
|
219 |
|
@@ -252,7 +300,7 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
252 |
*/
|
253 |
public function getSlaves()
|
254 |
{
|
255 |
-
return
|
256 |
}
|
257 |
|
258 |
/**
|
@@ -306,11 +354,7 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
306 |
*/
|
307 |
public function disconnect()
|
308 |
{
|
309 |
-
|
310 |
-
$this->master->disconnect();
|
311 |
-
}
|
312 |
-
|
313 |
-
foreach ($this->slaves as $connection) {
|
314 |
$connection->disconnect();
|
315 |
}
|
316 |
}
|
@@ -387,6 +431,7 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
387 |
$slaveConnection = $connectionFactory->create(array(
|
388 |
'host' => $parameters['host'],
|
389 |
'port' => $parameters['port'],
|
|
|
390 |
));
|
391 |
|
392 |
$this->add($slaveConnection);
|
@@ -412,7 +457,7 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
412 |
$masterConnection = $connectionFactory->create(array(
|
413 |
'host' => $replication['master_host'],
|
414 |
'port' => $replication['master_port'],
|
415 |
-
'
|
416 |
));
|
417 |
|
418 |
$this->add($masterConnection);
|
@@ -432,7 +477,7 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
432 |
{
|
433 |
RETRY_COMMAND: {
|
434 |
try {
|
435 |
-
$connection = $this->
|
436 |
$response = $connection->$method($command);
|
437 |
|
438 |
if ($response instanceof ResponseErrorInterface && $response->getErrorType() === 'LOADING') {
|
@@ -504,6 +549,6 @@ class MasterSlaveReplication implements ReplicationInterface
|
|
504 |
*/
|
505 |
public function __sleep()
|
506 |
{
|
507 |
-
return array('master', 'slaves', 'strategy');
|
508 |
}
|
509 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Replication;
|
13 |
|
14 |
use Predis\ClientException;
|
15 |
use Predis\Command\CommandInterface;
|
44 |
*/
|
45 |
protected $slaves = array();
|
46 |
|
47 |
+
/**
|
48 |
+
* @var NodeConnectionInterface[]
|
49 |
+
*/
|
50 |
+
protected $pool = array();
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @var NodeConnectionInterface[]
|
54 |
+
*/
|
55 |
+
protected $aliases = array();
|
56 |
+
|
57 |
/**
|
58 |
* @var NodeConnectionInterface
|
59 |
*/
|
115 |
*/
|
116 |
public function add(NodeConnectionInterface $connection)
|
117 |
{
|
118 |
+
$parameters = $connection->getParameters();
|
119 |
|
120 |
+
if ('master' === $parameters->role) {
|
121 |
$this->master = $connection;
|
122 |
} else {
|
123 |
+
// everything else is considered a slvave.
|
124 |
+
$this->slaves[] = $connection;
|
125 |
}
|
126 |
|
127 |
+
if (isset($parameters->alias)) {
|
128 |
+
$this->aliases[$parameters->alias] = $connection;
|
129 |
+
}
|
130 |
+
|
131 |
+
$this->pool[(string) $connection] = $connection;
|
132 |
+
|
133 |
$this->reset();
|
134 |
}
|
135 |
|
138 |
*/
|
139 |
public function remove(NodeConnectionInterface $connection)
|
140 |
{
|
141 |
+
if ($connection === $this->master) {
|
142 |
$this->master = null;
|
143 |
+
} elseif (false !== $id = array_search($connection, $this->slaves, true)) {
|
144 |
+
unset($this->slaves[$id]);
|
|
|
145 |
} else {
|
146 |
+
return false;
|
147 |
+
}
|
|
|
148 |
|
149 |
+
unset($this->pool[(string) $connection]);
|
150 |
+
|
151 |
+
if ($this->aliases && $alias = $connection->getParameters()->alias) {
|
152 |
+
unset($this->aliases[$alias]);
|
153 |
}
|
154 |
|
155 |
+
$this->reset();
|
156 |
+
|
157 |
+
return true;
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
* {@inheritdoc}
|
162 |
*/
|
163 |
+
public function getConnectionByCommand(CommandInterface $command)
|
164 |
{
|
165 |
if (!$this->current) {
|
166 |
if ($this->strategy->isReadOperation($command) && $slave = $this->pickSlave()) {
|
186 |
/**
|
187 |
* {@inheritdoc}
|
188 |
*/
|
189 |
+
public function getConnectionById($id)
|
190 |
{
|
191 |
+
if (isset($this->pool[$id])) {
|
192 |
+
return $this->pool[$id];
|
193 |
}
|
194 |
+
}
|
195 |
|
196 |
+
/**
|
197 |
+
* Returns a connection instance by its alias.
|
198 |
+
*
|
199 |
+
* @param string $alias Connection alias.
|
200 |
+
*
|
201 |
+
* @return NodeConnectionInterface|null
|
202 |
+
*/
|
203 |
+
public function getConnectionByAlias($alias)
|
204 |
+
{
|
205 |
+
if (isset($this->aliases[$alias])) {
|
206 |
+
return $this->aliases[$alias];
|
207 |
}
|
|
|
|
|
208 |
}
|
209 |
|
210 |
/**
|
211 |
+
* Returns a connection by its role.
|
212 |
+
*
|
213 |
+
* @param string $role Connection role (`master` or `slave`)
|
214 |
+
*
|
215 |
+
* @return NodeConnectionInterface|null
|
216 |
*/
|
217 |
+
public function getConnectionByRole($role)
|
218 |
{
|
219 |
+
if ($role === 'master') {
|
220 |
+
return $this->getMaster();
|
221 |
+
} elseif ($role === 'slave') {
|
222 |
+
return $this->pickSlave();
|
223 |
}
|
224 |
+
}
|
225 |
|
226 |
+
/**
|
227 |
+
* Switches the internal connection in use by the backend.
|
228 |
+
*
|
229 |
+
* @param NodeConnectionInterface $connection Connection instance in the pool.
|
230 |
+
*/
|
231 |
+
public function switchTo(NodeConnectionInterface $connection)
|
232 |
+
{
|
233 |
+
if ($connection && $connection === $this->current) {
|
234 |
+
return;
|
235 |
}
|
236 |
|
237 |
if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
+
* {@inheritdoc}
|
246 |
*/
|
247 |
public function switchToMaster()
|
248 |
{
|
249 |
+
if (!$connection = $this->getConnectionByRole('master')) {
|
250 |
+
throw new \InvalidArgumentException('Invalid connection or connection not found.');
|
251 |
+
}
|
252 |
+
|
253 |
+
$this->switchTo($connection);
|
254 |
}
|
255 |
|
256 |
/**
|
257 |
+
* {@inheritdoc}
|
258 |
*/
|
259 |
public function switchToSlave()
|
260 |
{
|
261 |
+
if (!$connection = $this->getConnectionByRole('slave')) {
|
262 |
+
throw new \InvalidArgumentException('Invalid connection or connection not found.');
|
263 |
+
}
|
264 |
+
|
265 |
$this->switchTo($connection);
|
266 |
}
|
267 |
|
300 |
*/
|
301 |
public function getSlaves()
|
302 |
{
|
303 |
+
return $this->slaves;
|
304 |
}
|
305 |
|
306 |
/**
|
354 |
*/
|
355 |
public function disconnect()
|
356 |
{
|
357 |
+
foreach ($this->pool as $connection) {
|
|
|
|
|
|
|
|
|
358 |
$connection->disconnect();
|
359 |
}
|
360 |
}
|
431 |
$slaveConnection = $connectionFactory->create(array(
|
432 |
'host' => $parameters['host'],
|
433 |
'port' => $parameters['port'],
|
434 |
+
'role' => 'slave',
|
435 |
));
|
436 |
|
437 |
$this->add($slaveConnection);
|
457 |
$masterConnection = $connectionFactory->create(array(
|
458 |
'host' => $replication['master_host'],
|
459 |
'port' => $replication['master_port'],
|
460 |
+
'role' => 'master',
|
461 |
));
|
462 |
|
463 |
$this->add($masterConnection);
|
477 |
{
|
478 |
RETRY_COMMAND: {
|
479 |
try {
|
480 |
+
$connection = $this->getConnectionByCommand($command);
|
481 |
$response = $connection->$method($command);
|
482 |
|
483 |
if ($response instanceof ResponseErrorInterface && $response->getErrorType() === 'LOADING') {
|
549 |
*/
|
550 |
public function __sleep()
|
551 |
{
|
552 |
+
return array('master', 'slaves', 'pool', 'aliases', 'strategy');
|
553 |
}
|
554 |
}
|
dependencies/predis/predis/src/Connection/{Aggregate → Replication}/ReplicationInterface.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\Connection\AggregateConnectionInterface;
|
15 |
use Predis\Connection\NodeConnectionInterface;
|
@@ -22,29 +22,31 @@ use Predis\Connection\NodeConnectionInterface;
|
|
22 |
interface ReplicationInterface extends AggregateConnectionInterface
|
23 |
{
|
24 |
/**
|
25 |
-
* Switches the internal connection
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
*/
|
29 |
-
public function
|
30 |
|
31 |
/**
|
32 |
-
* Returns the connection
|
33 |
-
* connection.
|
34 |
*
|
35 |
* @return NodeConnectionInterface
|
36 |
*/
|
37 |
public function getCurrent();
|
38 |
|
39 |
/**
|
40 |
-
* Returns the connection
|
41 |
*
|
42 |
* @return NodeConnectionInterface
|
43 |
*/
|
44 |
public function getMaster();
|
45 |
|
46 |
/**
|
47 |
-
* Returns a list of
|
48 |
*
|
49 |
* @return NodeConnectionInterface
|
50 |
*/
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Replication;
|
13 |
|
14 |
use Predis\Connection\AggregateConnectionInterface;
|
15 |
use Predis\Connection\NodeConnectionInterface;
|
22 |
interface ReplicationInterface extends AggregateConnectionInterface
|
23 |
{
|
24 |
/**
|
25 |
+
* Switches the internal connection in use to the master server.
|
26 |
+
*/
|
27 |
+
public function switchToMaster();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Switches the internal connection in use to a random slave server.
|
31 |
*/
|
32 |
+
public function switchToSlave();
|
33 |
|
34 |
/**
|
35 |
+
* Returns the connection in use by the replication backend.
|
|
|
36 |
*
|
37 |
* @return NodeConnectionInterface
|
38 |
*/
|
39 |
public function getCurrent();
|
40 |
|
41 |
/**
|
42 |
+
* Returns the connection to the master server.
|
43 |
*
|
44 |
* @return NodeConnectionInterface
|
45 |
*/
|
46 |
public function getMaster();
|
47 |
|
48 |
/**
|
49 |
+
* Returns a list of connections to slave servers.
|
50 |
*
|
51 |
* @return NodeConnectionInterface
|
52 |
*/
|
dependencies/predis/predis/src/Connection/{Aggregate → Replication}/SentinelReplication.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
namespace Predis\Connection\
|
13 |
|
14 |
use Predis\Command\CommandInterface;
|
15 |
use Predis\Command\RawCommand;
|
@@ -40,6 +40,11 @@ class SentinelReplication implements ReplicationInterface
|
|
40 |
*/
|
41 |
protected $slaves = array();
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @var NodeConnectionInterface
|
45 |
*/
|
@@ -184,6 +189,7 @@ class SentinelReplication implements ReplicationInterface
|
|
184 |
|
185 |
$this->master = null;
|
186 |
$this->slaves = array();
|
|
|
187 |
}
|
188 |
|
189 |
/**
|
@@ -191,14 +197,21 @@ class SentinelReplication implements ReplicationInterface
|
|
191 |
*/
|
192 |
public function add(NodeConnectionInterface $connection)
|
193 |
{
|
194 |
-
$
|
195 |
|
196 |
-
if (
|
197 |
$this->master = $connection;
|
|
|
|
|
|
|
|
|
198 |
} else {
|
199 |
-
|
|
|
200 |
}
|
201 |
|
|
|
|
|
202 |
$this->reset();
|
203 |
}
|
204 |
|
@@ -209,19 +222,21 @@ class SentinelReplication implements ReplicationInterface
|
|
209 |
{
|
210 |
if ($connection === $this->master) {
|
211 |
$this->master = null;
|
212 |
-
|
|
|
|
|
|
|
213 |
|
214 |
return true;
|
|
|
|
|
215 |
}
|
216 |
|
217 |
-
|
218 |
-
unset($this->slaves[$id]);
|
219 |
-
$this->reset();
|
220 |
|
221 |
-
|
222 |
-
}
|
223 |
|
224 |
-
return
|
225 |
}
|
226 |
|
227 |
/**
|
@@ -248,16 +263,13 @@ class SentinelReplication implements ReplicationInterface
|
|
248 |
// in a later release.
|
249 |
$parameters['database'] = null;
|
250 |
$parameters['username'] = null;
|
251 |
-
$parameters['password'] = null;
|
252 |
|
253 |
if (!isset($parameters['timeout'])) {
|
254 |
$parameters['timeout'] = $this->sentinelTimeout;
|
255 |
}
|
256 |
}
|
257 |
|
258 |
-
|
259 |
-
|
260 |
-
return $connection;
|
261 |
}
|
262 |
|
263 |
/**
|
@@ -302,6 +314,7 @@ class SentinelReplication implements ReplicationInterface
|
|
302 |
$this->sentinels[] = array(
|
303 |
'host' => $sentinel[3],
|
304 |
'port' => $sentinel[5],
|
|
|
305 |
);
|
306 |
}
|
307 |
} catch (ConnectionException $exception) {
|
@@ -364,7 +377,7 @@ class SentinelReplication implements ReplicationInterface
|
|
364 |
return array(
|
365 |
'host' => $payload[0],
|
366 |
'port' => $payload[1],
|
367 |
-
'
|
368 |
);
|
369 |
}
|
370 |
|
@@ -398,7 +411,7 @@ class SentinelReplication implements ReplicationInterface
|
|
398 |
$slaves[] = array(
|
399 |
'host' => $slave[3],
|
400 |
'port' => $slave[5],
|
401 |
-
'
|
402 |
);
|
403 |
}
|
404 |
|
@@ -473,7 +486,7 @@ class SentinelReplication implements ReplicationInterface
|
|
473 |
}
|
474 |
}
|
475 |
|
476 |
-
return array_values($this->slaves
|
477 |
}
|
478 |
|
479 |
/**
|
@@ -543,7 +556,7 @@ class SentinelReplication implements ReplicationInterface
|
|
543 |
/**
|
544 |
* {@inheritdoc}
|
545 |
*/
|
546 |
-
public function
|
547 |
{
|
548 |
$connection = $this->getConnectionInternal($command);
|
549 |
|
@@ -560,28 +573,41 @@ class SentinelReplication implements ReplicationInterface
|
|
560 |
/**
|
561 |
* {@inheritdoc}
|
562 |
*/
|
563 |
-
public function getConnectionById($
|
564 |
{
|
565 |
-
if ($
|
566 |
-
return $this->
|
567 |
-
}
|
568 |
-
|
569 |
-
$this->getSlaves();
|
570 |
-
|
571 |
-
if (isset($this->slaves[$connectionId])) {
|
572 |
-
return $this->slaves[$connectionId];
|
573 |
}
|
574 |
}
|
575 |
|
576 |
/**
|
577 |
-
*
|
|
|
|
|
|
|
|
|
578 |
*/
|
579 |
-
public function
|
580 |
{
|
581 |
-
if (
|
582 |
-
|
|
|
|
|
|
|
|
|
583 |
}
|
|
|
584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
if ($connection && $connection === $this->current) {
|
586 |
return;
|
587 |
}
|
@@ -600,19 +626,20 @@ class SentinelReplication implements ReplicationInterface
|
|
600 |
}
|
601 |
|
602 |
/**
|
603 |
-
*
|
604 |
*/
|
605 |
public function switchToMaster()
|
606 |
{
|
607 |
-
$this->
|
|
|
608 |
}
|
609 |
|
610 |
/**
|
611 |
-
*
|
612 |
*/
|
613 |
public function switchToSlave()
|
614 |
{
|
615 |
-
$connection = $this->
|
616 |
$this->switchTo($connection);
|
617 |
}
|
618 |
|
@@ -643,11 +670,7 @@ class SentinelReplication implements ReplicationInterface
|
|
643 |
*/
|
644 |
public function disconnect()
|
645 |
{
|
646 |
-
|
647 |
-
$this->master->disconnect();
|
648 |
-
}
|
649 |
-
|
650 |
-
foreach ($this->slaves as $connection) {
|
651 |
$connection->disconnect();
|
652 |
}
|
653 |
}
|
@@ -667,7 +690,7 @@ class SentinelReplication implements ReplicationInterface
|
|
667 |
|
668 |
SENTINEL_RETRY: {
|
669 |
try {
|
670 |
-
$response = $this->
|
671 |
} catch (CommunicationException $exception) {
|
672 |
$this->wipeServerList();
|
673 |
$exception->getConnection()->disconnect();
|
@@ -726,7 +749,7 @@ class SentinelReplication implements ReplicationInterface
|
|
726 |
public function __sleep()
|
727 |
{
|
728 |
return array(
|
729 |
-
'master', 'slaves', 'service', 'sentinels', 'connectionFactory', 'strategy',
|
730 |
);
|
731 |
}
|
732 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
namespace Predis\Connection\Replication;
|
13 |
|
14 |
use Predis\Command\CommandInterface;
|
15 |
use Predis\Command\RawCommand;
|
40 |
*/
|
41 |
protected $slaves = array();
|
42 |
|
43 |
+
/**
|
44 |
+
* @var NodeConnectionInterface[]
|
45 |
+
*/
|
46 |
+
protected $pool = array();
|
47 |
+
|
48 |
/**
|
49 |
* @var NodeConnectionInterface
|
50 |
*/
|
189 |
|
190 |
$this->master = null;
|
191 |
$this->slaves = array();
|
192 |
+
$this->pool = array();
|
193 |
}
|
194 |
|
195 |
/**
|
197 |
*/
|
198 |
public function add(NodeConnectionInterface $connection)
|
199 |
{
|
200 |
+
$parameters = $connection->getParameters();
|
201 |
|
202 |
+
if ('master' === $role = $parameters->role) {
|
203 |
$this->master = $connection;
|
204 |
+
} elseif ('sentinel' === $role) {
|
205 |
+
$this->sentinels[] = $connection;
|
206 |
+
// sentinels are not considered part of the pool.
|
207 |
+
return;
|
208 |
} else {
|
209 |
+
// everything else is considered a slave.
|
210 |
+
$this->slaves[] = $connection;
|
211 |
}
|
212 |
|
213 |
+
$this->pool[(string) $connection] = $connection;
|
214 |
+
|
215 |
$this->reset();
|
216 |
}
|
217 |
|
222 |
{
|
223 |
if ($connection === $this->master) {
|
224 |
$this->master = null;
|
225 |
+
} elseif (false !== $id = array_search($connection, $this->slaves, true)) {
|
226 |
+
unset($this->slaves[$id]);
|
227 |
+
} elseif (false !== $id = array_search($connection, $this->sentinels, true)) {
|
228 |
+
unset($this->sentinels[$id]);
|
229 |
|
230 |
return true;
|
231 |
+
} else {
|
232 |
+
return false;
|
233 |
}
|
234 |
|
235 |
+
unset($this->pool[(string) $connection]);
|
|
|
|
|
236 |
|
237 |
+
$this->reset();
|
|
|
238 |
|
239 |
+
return true;
|
240 |
}
|
241 |
|
242 |
/**
|
263 |
// in a later release.
|
264 |
$parameters['database'] = null;
|
265 |
$parameters['username'] = null;
|
|
|
266 |
|
267 |
if (!isset($parameters['timeout'])) {
|
268 |
$parameters['timeout'] = $this->sentinelTimeout;
|
269 |
}
|
270 |
}
|
271 |
|
272 |
+
return $this->connectionFactory->create($parameters);
|
|
|
|
|
273 |
}
|
274 |
|
275 |
/**
|
314 |
$this->sentinels[] = array(
|
315 |
'host' => $sentinel[3],
|
316 |
'port' => $sentinel[5],
|
317 |
+
'role' => 'sentinel',
|
318 |
);
|
319 |
}
|
320 |
} catch (ConnectionException $exception) {
|
377 |
return array(
|
378 |
'host' => $payload[0],
|
379 |
'port' => $payload[1],
|
380 |
+
'role' => 'master',
|
381 |
);
|
382 |
}
|
383 |
|
411 |
$slaves[] = array(
|
412 |
'host' => $slave[3],
|
413 |
'port' => $slave[5],
|
414 |
+
'role' => 'slave',
|
415 |
);
|
416 |
}
|
417 |
|
486 |
}
|
487 |
}
|
488 |
|
489 |
+
return array_values($this->slaves);
|
490 |
}
|
491 |
|
492 |
/**
|
556 |
/**
|
557 |
* {@inheritdoc}
|
558 |
*/
|
559 |
+
public function getConnectionByCommand(CommandInterface $command)
|
560 |
{
|
561 |
$connection = $this->getConnectionInternal($command);
|
562 |
|
573 |
/**
|
574 |
* {@inheritdoc}
|
575 |
*/
|
576 |
+
public function getConnectionById($id)
|
577 |
{
|
578 |
+
if (isset($this->pool[$id])) {
|
579 |
+
return $this->pool[$id];
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
}
|
581 |
}
|
582 |
|
583 |
/**
|
584 |
+
* Returns a connection by its role.
|
585 |
+
*
|
586 |
+
* @param string $role Connection role (`master`, `slave` or `sentinel`)
|
587 |
+
*
|
588 |
+
* @return NodeConnectionInterface|null
|
589 |
*/
|
590 |
+
public function getConnectionByRole($role)
|
591 |
{
|
592 |
+
if ($role === 'master') {
|
593 |
+
return $this->getMaster();
|
594 |
+
} elseif ($role === 'slave') {
|
595 |
+
return $this->pickSlave();
|
596 |
+
} elseif ($role === 'sentinel') {
|
597 |
+
return $this->getSentinelConnection();
|
598 |
}
|
599 |
+
}
|
600 |
|
601 |
+
/**
|
602 |
+
* Switches the internal connection in use by the backend.
|
603 |
+
*
|
604 |
+
* Sentinel connections are not considered as part of the pool, meaning that
|
605 |
+
* trying to switch to a sentinel will throw an exception.
|
606 |
+
*
|
607 |
+
* @param NodeConnectionInterface $connection Connection instance in the pool.
|
608 |
+
*/
|
609 |
+
public function switchTo(NodeConnectionInterface $connection)
|
610 |
+
{
|
611 |
if ($connection && $connection === $this->current) {
|
612 |
return;
|
613 |
}
|
626 |
}
|
627 |
|
628 |
/**
|
629 |
+
* {@inheritdoc}
|
630 |
*/
|
631 |
public function switchToMaster()
|
632 |
{
|
633 |
+
$connection = $this->getConnectionByRole('master');
|
634 |
+
$this->switchTo($connection);
|
635 |
}
|
636 |
|
637 |
/**
|
638 |
+
* {@inheritdoc}
|
639 |
*/
|
640 |
public function switchToSlave()
|
641 |
{
|
642 |
+
$connection = $this->getConnectionByRole('slave');
|
643 |
$this->switchTo($connection);
|
644 |
}
|
645 |
|
670 |
*/
|
671 |
public function disconnect()
|
672 |
{
|
673 |
+
foreach ($this->pool as $connection) {
|
|
|
|
|
|
|
|
|
674 |
$connection->disconnect();
|
675 |
}
|
676 |
}
|
690 |
|
691 |
SENTINEL_RETRY: {
|
692 |
try {
|
693 |
+
$response = $this->getConnectionByCommand($command)->$method($command);
|
694 |
} catch (CommunicationException $exception) {
|
695 |
$this->wipeServerList();
|
696 |
$exception->getConnection()->disconnect();
|
749 |
public function __sleep()
|
750 |
{
|
751 |
return array(
|
752 |
+
'master', 'slaves', 'pool', 'service', 'sentinels', 'connectionFactory', 'strategy',
|
753 |
);
|
754 |
}
|
755 |
}
|
dependencies/predis/predis/src/Connection/StreamConnection.php
CHANGED
@@ -58,11 +58,8 @@ class StreamConnection extends AbstractConnection
|
|
58 |
case 'tcp':
|
59 |
case 'redis':
|
60 |
case 'unix':
|
61 |
-
break;
|
62 |
-
|
63 |
case 'tls':
|
64 |
case 'rediss':
|
65 |
-
$this->assertSslSupport($parameters);
|
66 |
break;
|
67 |
|
68 |
default:
|
@@ -72,23 +69,6 @@ class StreamConnection extends AbstractConnection
|
|
72 |
return $parameters;
|
73 |
}
|
74 |
|
75 |
-
/**
|
76 |
-
* Checks needed conditions for SSL-encrypted connections.
|
77 |
-
*
|
78 |
-
* @param ParametersInterface $parameters Initialization parameters for the connection.
|
79 |
-
*
|
80 |
-
* @throws \InvalidArgumentException
|
81 |
-
*/
|
82 |
-
protected function assertSslSupport(ParametersInterface $parameters)
|
83 |
-
{
|
84 |
-
if (
|
85 |
-
filter_var($parameters->persistent, FILTER_VALIDATE_BOOLEAN) &&
|
86 |
-
version_compare(PHP_VERSION, '7.0.0beta') < 0
|
87 |
-
) {
|
88 |
-
throw new \InvalidArgumentException('Persistent SSL connections require PHP >= 7.0.0.');
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
/**
|
93 |
* {@inheritdoc}
|
94 |
*/
|
@@ -123,8 +103,9 @@ class StreamConnection extends AbstractConnection
|
|
123 |
protected function createStreamSocket(ParametersInterface $parameters, $address, $flags)
|
124 |
{
|
125 |
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
|
|
|
126 |
|
127 |
-
if (!$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags)) {
|
128 |
$this->onConnectionError(trim($errstr), $errno);
|
129 |
}
|
130 |
|
@@ -136,11 +117,6 @@ class StreamConnection extends AbstractConnection
|
|
136 |
stream_set_timeout($resource, $timeoutSeconds, $timeoutUSeconds);
|
137 |
}
|
138 |
|
139 |
-
if (isset($parameters->tcp_nodelay) && function_exists('socket_import_stream')) {
|
140 |
-
$socket = socket_import_stream($resource);
|
141 |
-
socket_set_option($socket, SOL_TCP, TCP_NODELAY, (int) $parameters->tcp_nodelay);
|
142 |
-
}
|
143 |
-
|
144 |
return $resource;
|
145 |
}
|
146 |
|
@@ -175,9 +151,7 @@ class StreamConnection extends AbstractConnection
|
|
175 |
}
|
176 |
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
return $resource;
|
181 |
}
|
182 |
|
183 |
/**
|
@@ -207,9 +181,7 @@ class StreamConnection extends AbstractConnection
|
|
207 |
}
|
208 |
}
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
return $resource;
|
213 |
}
|
214 |
|
215 |
/**
|
@@ -361,6 +333,7 @@ class StreamConnection extends AbstractConnection
|
|
361 |
|
362 |
case ':':
|
363 |
$integer = (int) $payload;
|
|
|
364 |
return $integer == $payload ? $integer : $payload;
|
365 |
|
366 |
case '-':
|
58 |
case 'tcp':
|
59 |
case 'redis':
|
60 |
case 'unix':
|
|
|
|
|
61 |
case 'tls':
|
62 |
case 'rediss':
|
|
|
63 |
break;
|
64 |
|
65 |
default:
|
69 |
return $parameters;
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/**
|
73 |
* {@inheritdoc}
|
74 |
*/
|
103 |
protected function createStreamSocket(ParametersInterface $parameters, $address, $flags)
|
104 |
{
|
105 |
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
|
106 |
+
$context = stream_context_create(['socket' => ['tcp_nodelay' => (bool) $parameters->tcp_nodelay]]);
|
107 |
|
108 |
+
if (!$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags, $context)) {
|
109 |
$this->onConnectionError(trim($errstr), $errno);
|
110 |
}
|
111 |
|
117 |
stream_set_timeout($resource, $timeoutSeconds, $timeoutUSeconds);
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
120 |
return $resource;
|
121 |
}
|
122 |
|
151 |
}
|
152 |
}
|
153 |
|
154 |
+
return $this->createStreamSocket($parameters, $address, $flags);
|
|
|
|
|
155 |
}
|
156 |
|
157 |
/**
|
181 |
}
|
182 |
}
|
183 |
|
184 |
+
return $this->createStreamSocket($parameters, "unix://{$parameters->path}", $flags);
|
|
|
|
|
185 |
}
|
186 |
|
187 |
/**
|
333 |
|
334 |
case ':':
|
335 |
$integer = (int) $payload;
|
336 |
+
|
337 |
return $integer == $payload ? $integer : $payload;
|
338 |
|
339 |
case '-':
|
dependencies/predis/predis/src/Connection/WebdisConnection.php
CHANGED
@@ -292,10 +292,10 @@ class WebdisConnection implements NodeConnectionInterface
|
|
292 |
curl_setopt($resource, CURLOPT_POSTFIELDS, $serializedCommand);
|
293 |
|
294 |
if (curl_exec($resource) === false) {
|
295 |
-
$error = curl_error($resource);
|
296 |
$errno = curl_errno($resource);
|
297 |
|
298 |
-
throw new ConnectionException($this,
|
299 |
}
|
300 |
|
301 |
if (phpiredis_reader_get_state($this->reader) !== PHPIREDIS_READER_STATE_COMPLETE) {
|
292 |
curl_setopt($resource, CURLOPT_POSTFIELDS, $serializedCommand);
|
293 |
|
294 |
if (curl_exec($resource) === false) {
|
295 |
+
$error = trim(curl_error($resource));
|
296 |
$errno = curl_errno($resource);
|
297 |
|
298 |
+
throw new ConnectionException($this, "$error{$this->getParameters()}]", $errno);
|
299 |
}
|
300 |
|
301 |
if (phpiredis_reader_get_state($this->reader) !== PHPIREDIS_READER_STATE_COMPLETE) {
|
dependencies/predis/predis/src/Monitor/Consumer.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
namespace Predis\Monitor;
|
13 |
|
14 |
use Predis\ClientInterface;
|
15 |
-
use Predis\Connection\
|
16 |
use Predis\NotSupportedException;
|
17 |
|
18 |
/**
|
@@ -56,14 +56,14 @@ class Consumer implements \Iterator
|
|
56 |
*/
|
57 |
private function assertClient(ClientInterface $client)
|
58 |
{
|
59 |
-
if ($client->getConnection() instanceof
|
60 |
throw new NotSupportedException(
|
61 |
-
'Cannot initialize a monitor consumer over
|
62 |
);
|
63 |
}
|
64 |
|
65 |
-
if (
|
66 |
-
throw new NotSupportedException("
|
67 |
}
|
68 |
}
|
69 |
|
12 |
namespace Predis\Monitor;
|
13 |
|
14 |
use Predis\ClientInterface;
|
15 |
+
use Predis\Connection\Cluster\ClusterInterface;
|
16 |
use Predis\NotSupportedException;
|
17 |
|
18 |
/**
|
56 |
*/
|
57 |
private function assertClient(ClientInterface $client)
|
58 |
{
|
59 |
+
if ($client->getConnection() instanceof ClusterInterface) {
|
60 |
throw new NotSupportedException(
|
61 |
+
'Cannot initialize a monitor consumer over cluster connections.'
|
62 |
);
|
63 |
}
|
64 |
|
65 |
+
if (!$client->getCommandFactory()->supports('MONITOR')) {
|
66 |
+
throw new NotSupportedException("'MONITOR' is not supported by the current command factory.");
|
67 |
}
|
68 |
}
|
69 |
|
dependencies/predis/predis/src/Pipeline/Atomic.php
CHANGED
@@ -31,9 +31,9 @@ class Atomic extends Pipeline
|
|
31 |
*/
|
32 |
public function __construct(ClientInterface $client)
|
33 |
{
|
34 |
-
if (!$client->
|
35 |
throw new ClientException(
|
36 |
-
"
|
37 |
);
|
38 |
}
|
39 |
|
@@ -61,8 +61,8 @@ class Atomic extends Pipeline
|
|
61 |
*/
|
62 |
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
|
63 |
{
|
64 |
-
$
|
65 |
-
$connection->executeCommand($
|
66 |
|
67 |
foreach ($commands as $command) {
|
68 |
$connection->writeRequest($command);
|
@@ -72,12 +72,12 @@ class Atomic extends Pipeline
|
|
72 |
$response = $connection->readResponse($command);
|
73 |
|
74 |
if ($response instanceof ErrorResponseInterface) {
|
75 |
-
$connection->executeCommand($
|
76 |
throw new ServerException($response->getMessage());
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
$executed = $connection->executeCommand($
|
81 |
|
82 |
if (!isset($executed)) {
|
83 |
// TODO: should be throwing a more appropriate exception.
|
31 |
*/
|
32 |
public function __construct(ClientInterface $client)
|
33 |
{
|
34 |
+
if (!$client->getCommandFactory()->supports('multi', 'exec', 'discard')) {
|
35 |
throw new ClientException(
|
36 |
+
"'MULTI', 'EXEC' and 'DISCARD' are not supported by the current command factory."
|
37 |
);
|
38 |
}
|
39 |
|
61 |
*/
|
62 |
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
|
63 |
{
|
64 |
+
$commandFactory = $this->getClient()->getCommandFactory();
|
65 |
+
$connection->executeCommand($commandFactory->create('multi'));
|
66 |
|
67 |
foreach ($commands as $command) {
|
68 |
$connection->writeRequest($command);
|
72 |
$response = $connection->readResponse($command);
|
73 |
|
74 |
if ($response instanceof ErrorResponseInterface) {
|
75 |
+
$connection->executeCommand($commandFactory->create('discard'));
|
76 |
throw new ServerException($response->getMessage());
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
$executed = $connection->executeCommand($commandFactory->create('exec'));
|
81 |
|
82 |
if (!isset($executed)) {
|
83 |
// TODO: should be throwing a more appropriate exception.
|
dependencies/predis/predis/src/Pipeline/ConnectionErrorProof.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
namespace Predis\Pipeline;
|
13 |
|
14 |
use Predis\CommunicationException;
|
15 |
-
use Predis\Connection\
|
16 |
use Predis\Connection\ConnectionInterface;
|
17 |
use Predis\Connection\NodeConnectionInterface;
|
18 |
use Predis\NotSupportedException;
|
@@ -93,7 +93,7 @@ class ConnectionErrorProof extends Pipeline
|
|
93 |
$exceptions = array();
|
94 |
|
95 |
foreach ($commands as $command) {
|
96 |
-
$cmdConnection = $connection->
|
97 |
|
98 |
if (isset($exceptions[spl_object_hash($cmdConnection)])) {
|
99 |
continue;
|
@@ -109,7 +109,7 @@ class ConnectionErrorProof extends Pipeline
|
|
109 |
for ($i = 0; $i < $sizeOfPipe; ++$i) {
|
110 |
$command = $commands->dequeue();
|
111 |
|
112 |
-
$cmdConnection = $connection->
|
113 |
$connectionHash = spl_object_hash($cmdConnection);
|
114 |
|
115 |
if (isset($exceptions[$connectionHash])) {
|
12 |
namespace Predis\Pipeline;
|
13 |
|
14 |
use Predis\CommunicationException;
|
15 |
+
use Predis\Connection\Cluster\ClusterInterface;
|
16 |
use Predis\Connection\ConnectionInterface;
|
17 |
use Predis\Connection\NodeConnectionInterface;
|
18 |
use Predis\NotSupportedException;
|
93 |
$exceptions = array();
|
94 |
|
95 |
foreach ($commands as $command) {
|
96 |
+
$cmdConnection = $connection->getConnectionByCommand($command);
|
97 |
|
98 |
if (isset($exceptions[spl_object_hash($cmdConnection)])) {
|
99 |
continue;
|
109 |
for ($i = 0; $i < $sizeOfPipe; ++$i) {
|
110 |
$command = $commands->dequeue();
|
111 |
|
112 |
+
$cmdConnection = $connection->getConnectionByCommand($command);
|
113 |
$connectionHash = spl_object_hash($cmdConnection);
|
114 |
|
115 |
if (isset($exceptions[$connectionHash])) {
|
dependencies/predis/predis/src/Pipeline/Pipeline.php
CHANGED
@@ -15,8 +15,8 @@ use Predis\ClientContextInterface;
|
|
15 |
use Predis\ClientException;
|
16 |
use Predis\ClientInterface;
|
17 |
use Predis\Command\CommandInterface;
|
18 |
-
use Predis\Connection\Aggregate\ReplicationInterface;
|
19 |
use Predis\Connection\ConnectionInterface;
|
|
|
20 |
use Predis\Response\ErrorInterface as ErrorResponseInterface;
|
21 |
use Predis\Response\ResponseInterface;
|
22 |
use Predis\Response\ServerException;
|
@@ -112,7 +112,7 @@ class Pipeline implements ClientContextInterface
|
|
112 |
$connection = $this->getClient()->getConnection();
|
113 |
|
114 |
if ($connection instanceof ReplicationInterface) {
|
115 |
-
$connection->
|
116 |
}
|
117 |
|
118 |
return $connection;
|
15 |
use Predis\ClientException;
|
16 |
use Predis\ClientInterface;
|
17 |
use Predis\Command\CommandInterface;
|
|
|
18 |
use Predis\Connection\ConnectionInterface;
|
19 |
+
use Predis\Connection\Replication\ReplicationInterface;
|
20 |
use Predis\Response\ErrorInterface as ErrorResponseInterface;
|
21 |
use Predis\Response\ResponseInterface;
|
22 |
use Predis\Response\ServerException;
|
112 |
$connection = $this->getClient()->getConnection();
|
113 |
|
114 |
if ($connection instanceof ReplicationInterface) {
|
115 |
+
$connection->switchToMaster();
|
116 |
}
|
117 |
|
118 |
return $connection;
|
dependencies/predis/predis/src/Profile/Factory.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
use Predis\ClientException;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Factory class for creating profile instances from strings.
|
18 |
-
*
|
19 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
20 |
-
*/
|
21 |
-
final class Factory
|
22 |
-
{
|
23 |
-
private static $profiles = array(
|
24 |
-
'2.0' => 'Predis\Profile\RedisVersion200',
|
25 |
-
'2.2' => 'Predis\Profile\RedisVersion220',
|
26 |
-
'2.4' => 'Predis\Profile\RedisVersion240',
|
27 |
-
'2.6' => 'Predis\Profile\RedisVersion260',
|
28 |
-
'2.8' => 'Predis\Profile\RedisVersion280',
|
29 |
-
'3.0' => 'Predis\Profile\RedisVersion300',
|
30 |
-
'3.2' => 'Predis\Profile\RedisVersion320',
|
31 |
-
'dev' => 'Predis\Profile\RedisUnstable',
|
32 |
-
'default' => 'Predis\Profile\RedisVersion320',
|
33 |
-
);
|
34 |
-
|
35 |
-
/**
|
36 |
-
*
|
37 |
-
*/
|
38 |
-
private function __construct()
|
39 |
-
{
|
40 |
-
// NOOP
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the default server profile.
|
45 |
-
*
|
46 |
-
* @return ProfileInterface
|
47 |
-
*/
|
48 |
-
public static function getDefault()
|
49 |
-
{
|
50 |
-
return self::get('default');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the development server profile.
|
55 |
-
*
|
56 |
-
* @return ProfileInterface
|
57 |
-
*/
|
58 |
-
public static function getDevelopment()
|
59 |
-
{
|
60 |
-
return self::get('dev');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Registers a new server profile.
|
65 |
-
*
|
66 |
-
* @param string $alias Profile version or alias.
|
67 |
-
* @param string $class FQN of a class implementing Predis\Profile\ProfileInterface.
|
68 |
-
*
|
69 |
-
* @throws \InvalidArgumentException
|
70 |
-
*/
|
71 |
-
public static function define($alias, $class)
|
72 |
-
{
|
73 |
-
$reflection = new \ReflectionClass($class);
|
74 |
-
|
75 |
-
if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) {
|
76 |
-
throw new \InvalidArgumentException("The class '$class' is not a valid profile class.");
|
77 |
-
}
|
78 |
-
|
79 |
-
self::$profiles[$alias] = $class;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns the specified server profile.
|
84 |
-
*
|
85 |
-
* @param string $version Profile version or alias.
|
86 |
-
*
|
87 |
-
* @throws ClientException
|
88 |
-
*
|
89 |
-
* @return ProfileInterface
|
90 |
-
*/
|
91 |
-
public static function get($version)
|
92 |
-
{
|
93 |
-
if (!isset(self::$profiles[$version])) {
|
94 |
-
throw new ClientException("Unknown server profile: '$version'.");
|
95 |
-
}
|
96 |
-
|
97 |
-
$profile = self::$profiles[$version];
|
98 |
-
|
99 |
-
return new $profile();
|
100 |
-
}
|
101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/ProfileInterface.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
use Predis\Command\CommandInterface;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* A profile defines all the features and commands supported by certain versions
|
18 |
-
* of Redis. Instances of Predis\Client should use a server profile matching the
|
19 |
-
* version of Redis being used.
|
20 |
-
*
|
21 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22 |
-
*/
|
23 |
-
interface ProfileInterface
|
24 |
-
{
|
25 |
-
/**
|
26 |
-
* Returns the profile version corresponding to the Redis version.
|
27 |
-
*
|
28 |
-
* @return string
|
29 |
-
*/
|
30 |
-
public function getVersion();
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Checks if the profile supports the specified command.
|
34 |
-
*
|
35 |
-
* @param string $commandID Command ID.
|
36 |
-
*
|
37 |
-
* @return bool
|
38 |
-
*/
|
39 |
-
public function supportsCommand($commandID);
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Checks if the profile supports the specified list of commands.
|
43 |
-
*
|
44 |
-
* @param array $commandIDs List of command IDs.
|
45 |
-
*
|
46 |
-
* @return string
|
47 |
-
*/
|
48 |
-
public function supportsCommands(array $commandIDs);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Creates a new command instance.
|
52 |
-
*
|
53 |
-
* @param string $commandID Command ID.
|
54 |
-
* @param array $arguments Arguments for the command.
|
55 |
-
*
|
56 |
-
* @return CommandInterface
|
57 |
-
*/
|
58 |
-
public function createCommand($commandID, array $arguments = array());
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisProfile.php
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
use Predis\ClientException;
|
15 |
-
use Predis\Command\Processor\ProcessorInterface;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Base class implementing common functionalities for Redis server profiles.
|
19 |
-
*
|
20 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
21 |
-
*/
|
22 |
-
abstract class RedisProfile implements ProfileInterface
|
23 |
-
{
|
24 |
-
private $commands;
|
25 |
-
private $processor;
|
26 |
-
|
27 |
-
/**
|
28 |
-
*
|
29 |
-
*/
|
30 |
-
public function __construct()
|
31 |
-
{
|
32 |
-
$this->commands = $this->getSupportedCommands();
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Returns a map of all the commands supported by the profile and their
|
37 |
-
* actual PHP classes.
|
38 |
-
*
|
39 |
-
* @return array
|
40 |
-
*/
|
41 |
-
abstract protected function getSupportedCommands();
|
42 |
-
|
43 |
-
/**
|
44 |
-
* {@inheritdoc}
|
45 |
-
*/
|
46 |
-
public function supportsCommand($commandID)
|
47 |
-
{
|
48 |
-
return isset($this->commands[strtoupper($commandID)]);
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* {@inheritdoc}
|
53 |
-
*/
|
54 |
-
public function supportsCommands(array $commandIDs)
|
55 |
-
{
|
56 |
-
foreach ($commandIDs as $commandID) {
|
57 |
-
if (!$this->supportsCommand($commandID)) {
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
return true;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Returns the fully-qualified name of a class representing the specified
|
67 |
-
* command ID registered in the current server profile.
|
68 |
-
*
|
69 |
-
* @param string $commandID Command ID.
|
70 |
-
*
|
71 |
-
* @return string|null
|
72 |
-
*/
|
73 |
-
public function getCommandClass($commandID)
|
74 |
-
{
|
75 |
-
if (isset($this->commands[$commandID = strtoupper($commandID)])) {
|
76 |
-
return $this->commands[$commandID];
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* {@inheritdoc}
|
82 |
-
*/
|
83 |
-
public function createCommand($commandID, array $arguments = array())
|
84 |
-
{
|
85 |
-
$commandID = strtoupper($commandID);
|
86 |
-
|
87 |
-
if (!isset($this->commands[$commandID])) {
|
88 |
-
throw new ClientException("Command '$commandID' is not a registered Redis command.");
|
89 |
-
}
|
90 |
-
|
91 |
-
$commandClass = $this->commands[$commandID];
|
92 |
-
$command = new $commandClass();
|
93 |
-
$command->setArguments($arguments);
|
94 |
-
|
95 |
-
if (isset($this->processor)) {
|
96 |
-
$this->processor->process($command);
|
97 |
-
}
|
98 |
-
|
99 |
-
return $command;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Defines a new command in the server profile.
|
104 |
-
*
|
105 |
-
* @param string $commandID Command ID.
|
106 |
-
* @param string $class Fully-qualified name of a Predis\Command\CommandInterface.
|
107 |
-
*
|
108 |
-
* @throws \InvalidArgumentException
|
109 |
-
*/
|
110 |
-
public function defineCommand($commandID, $class)
|
111 |
-
{
|
112 |
-
$reflection = new \ReflectionClass($class);
|
113 |
-
|
114 |
-
if (!$reflection->isSubclassOf('Predis\Command\CommandInterface')) {
|
115 |
-
throw new \InvalidArgumentException("The class '$class' is not a valid command class.");
|
116 |
-
}
|
117 |
-
|
118 |
-
$this->commands[strtoupper($commandID)] = $class;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* {@inheritdoc}
|
123 |
-
*/
|
124 |
-
public function setProcessor(ProcessorInterface $processor = null)
|
125 |
-
{
|
126 |
-
$this->processor = $processor;
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* {@inheritdoc}
|
131 |
-
*/
|
132 |
-
public function getProcessor()
|
133 |
-
{
|
134 |
-
return $this->processor;
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Returns the version of server profile as its string representation.
|
139 |
-
*
|
140 |
-
* @return string
|
141 |
-
*/
|
142 |
-
public function __toString()
|
143 |
-
{
|
144 |
-
return $this->getVersion();
|
145 |
-
}
|
146 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisUnstable.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for the current unstable version of Redis.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisUnstable extends RedisVersion320
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '3.2';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array_merge(parent::getSupportedCommands(), array(
|
35 |
-
// EMPTY
|
36 |
-
));
|
37 |
-
}
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion200.php
DELETED
@@ -1,173 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 2.0.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion200 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '2.0';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
|
51 |
-
/* commands operating on string values */
|
52 |
-
'SET' => 'Predis\Command\StringSet',
|
53 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
54 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
55 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
56 |
-
'GET' => 'Predis\Command\StringGet',
|
57 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
58 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
59 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
60 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
61 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
62 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
63 |
-
|
64 |
-
/* commands operating on lists */
|
65 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
66 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
67 |
-
'LLEN' => 'Predis\Command\ListLength',
|
68 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
69 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
70 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
71 |
-
'LSET' => 'Predis\Command\ListSet',
|
72 |
-
'LREM' => 'Predis\Command\ListRemove',
|
73 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
74 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
75 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
76 |
-
|
77 |
-
/* commands operating on sets */
|
78 |
-
'SADD' => 'Predis\Command\SetAdd',
|
79 |
-
'SREM' => 'Predis\Command\SetRemove',
|
80 |
-
'SPOP' => 'Predis\Command\SetPop',
|
81 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
82 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
83 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
84 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
85 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
86 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
87 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
88 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
89 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
90 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
91 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
92 |
-
|
93 |
-
/* commands operating on sorted sets */
|
94 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
95 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
96 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
97 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
98 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
99 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
100 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
101 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
102 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
103 |
-
|
104 |
-
/* connection related commands */
|
105 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
106 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
107 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
108 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
109 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
110 |
-
|
111 |
-
/* remote server control commands */
|
112 |
-
'INFO' => 'Predis\Command\ServerInfo',
|
113 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
114 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
115 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
116 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
117 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
118 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
119 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
120 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
121 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
122 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
123 |
-
|
124 |
-
/* ---------------- Redis 2.0 ---------------- */
|
125 |
-
|
126 |
-
/* commands operating on string values */
|
127 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
128 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
129 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
130 |
-
|
131 |
-
/* commands operating on lists */
|
132 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
133 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
134 |
-
|
135 |
-
/* commands operating on sorted sets */
|
136 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
137 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
138 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
139 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
140 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
141 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
142 |
-
|
143 |
-
/* commands operating on hashes */
|
144 |
-
'HSET' => 'Predis\Command\HashSet',
|
145 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
146 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
147 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
148 |
-
'HGET' => 'Predis\Command\HashGet',
|
149 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
150 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
151 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
152 |
-
'HLEN' => 'Predis\Command\HashLength',
|
153 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
154 |
-
'HVALS' => 'Predis\Command\HashValues',
|
155 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
156 |
-
|
157 |
-
/* transactions */
|
158 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
159 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
160 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
161 |
-
|
162 |
-
/* publish - subscribe */
|
163 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
164 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
165 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
166 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
167 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
168 |
-
|
169 |
-
/* remote server control commands */
|
170 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
171 |
-
);
|
172 |
-
}
|
173 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion220.php
DELETED
@@ -1,202 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 2.2.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion220 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '2.2';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
|
51 |
-
/* commands operating on string values */
|
52 |
-
'SET' => 'Predis\Command\StringSet',
|
53 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
54 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
55 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
56 |
-
'GET' => 'Predis\Command\StringGet',
|
57 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
58 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
59 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
60 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
61 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
62 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
63 |
-
|
64 |
-
/* commands operating on lists */
|
65 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
66 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
67 |
-
'LLEN' => 'Predis\Command\ListLength',
|
68 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
69 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
70 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
71 |
-
'LSET' => 'Predis\Command\ListSet',
|
72 |
-
'LREM' => 'Predis\Command\ListRemove',
|
73 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
74 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
75 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
76 |
-
|
77 |
-
/* commands operating on sets */
|
78 |
-
'SADD' => 'Predis\Command\SetAdd',
|
79 |
-
'SREM' => 'Predis\Command\SetRemove',
|
80 |
-
'SPOP' => 'Predis\Command\SetPop',
|
81 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
82 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
83 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
84 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
85 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
86 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
87 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
88 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
89 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
90 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
91 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
92 |
-
|
93 |
-
/* commands operating on sorted sets */
|
94 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
95 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
96 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
97 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
98 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
99 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
100 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
101 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
102 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
103 |
-
|
104 |
-
/* connection related commands */
|
105 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
106 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
107 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
108 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
109 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
110 |
-
|
111 |
-
/* remote server control commands */
|
112 |
-
'INFO' => 'Predis\Command\ServerInfo',
|
113 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
114 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
115 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
116 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
117 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
118 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
119 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
120 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
121 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
122 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
123 |
-
|
124 |
-
/* ---------------- Redis 2.0 ---------------- */
|
125 |
-
|
126 |
-
/* commands operating on string values */
|
127 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
128 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
129 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
130 |
-
|
131 |
-
/* commands operating on lists */
|
132 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
133 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
134 |
-
|
135 |
-
/* commands operating on sorted sets */
|
136 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
137 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
138 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
139 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
140 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
141 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
142 |
-
|
143 |
-
/* commands operating on hashes */
|
144 |
-
'HSET' => 'Predis\Command\HashSet',
|
145 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
146 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
147 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
148 |
-
'HGET' => 'Predis\Command\HashGet',
|
149 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
150 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
151 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
152 |
-
'HLEN' => 'Predis\Command\HashLength',
|
153 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
154 |
-
'HVALS' => 'Predis\Command\HashValues',
|
155 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
156 |
-
|
157 |
-
/* transactions */
|
158 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
159 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
160 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
161 |
-
|
162 |
-
/* publish - subscribe */
|
163 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
164 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
165 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
166 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
167 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
168 |
-
|
169 |
-
/* remote server control commands */
|
170 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
171 |
-
|
172 |
-
/* ---------------- Redis 2.2 ---------------- */
|
173 |
-
|
174 |
-
/* commands operating on the key space */
|
175 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
176 |
-
|
177 |
-
/* commands operating on string values */
|
178 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
179 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
180 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
181 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
182 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
183 |
-
|
184 |
-
/* commands operating on lists */
|
185 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
186 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
187 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
188 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
189 |
-
|
190 |
-
/* commands operating on sorted sets */
|
191 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
192 |
-
|
193 |
-
/* transactions */
|
194 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
195 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
196 |
-
|
197 |
-
/* remote server control commands */
|
198 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
199 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
200 |
-
);
|
201 |
-
}
|
202 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion240.php
DELETED
@@ -1,207 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 2.4.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion240 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '2.4';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
|
51 |
-
/* commands operating on string values */
|
52 |
-
'SET' => 'Predis\Command\StringSet',
|
53 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
54 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
55 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
56 |
-
'GET' => 'Predis\Command\StringGet',
|
57 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
58 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
59 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
60 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
61 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
62 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
63 |
-
|
64 |
-
/* commands operating on lists */
|
65 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
66 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
67 |
-
'LLEN' => 'Predis\Command\ListLength',
|
68 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
69 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
70 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
71 |
-
'LSET' => 'Predis\Command\ListSet',
|
72 |
-
'LREM' => 'Predis\Command\ListRemove',
|
73 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
74 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
75 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
76 |
-
|
77 |
-
/* commands operating on sets */
|
78 |
-
'SADD' => 'Predis\Command\SetAdd',
|
79 |
-
'SREM' => 'Predis\Command\SetRemove',
|
80 |
-
'SPOP' => 'Predis\Command\SetPop',
|
81 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
82 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
83 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
84 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
85 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
86 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
87 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
88 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
89 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
90 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
91 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
92 |
-
|
93 |
-
/* commands operating on sorted sets */
|
94 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
95 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
96 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
97 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
98 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
99 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
100 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
101 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
102 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
103 |
-
|
104 |
-
/* connection related commands */
|
105 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
106 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
107 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
108 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
109 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
110 |
-
|
111 |
-
/* remote server control commands */
|
112 |
-
'INFO' => 'Predis\Command\ServerInfo',
|
113 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
114 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
115 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
116 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
117 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
118 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
119 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
120 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
121 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
122 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
123 |
-
|
124 |
-
/* ---------------- Redis 2.0 ---------------- */
|
125 |
-
|
126 |
-
/* commands operating on string values */
|
127 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
128 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
129 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
130 |
-
|
131 |
-
/* commands operating on lists */
|
132 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
133 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
134 |
-
|
135 |
-
/* commands operating on sorted sets */
|
136 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
137 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
138 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
139 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
140 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
141 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
142 |
-
|
143 |
-
/* commands operating on hashes */
|
144 |
-
'HSET' => 'Predis\Command\HashSet',
|
145 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
146 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
147 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
148 |
-
'HGET' => 'Predis\Command\HashGet',
|
149 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
150 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
151 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
152 |
-
'HLEN' => 'Predis\Command\HashLength',
|
153 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
154 |
-
'HVALS' => 'Predis\Command\HashValues',
|
155 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
156 |
-
|
157 |
-
/* transactions */
|
158 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
159 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
160 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
161 |
-
|
162 |
-
/* publish - subscribe */
|
163 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
164 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
165 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
166 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
167 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
168 |
-
|
169 |
-
/* remote server control commands */
|
170 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
171 |
-
|
172 |
-
/* ---------------- Redis 2.2 ---------------- */
|
173 |
-
|
174 |
-
/* commands operating on the key space */
|
175 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
176 |
-
|
177 |
-
/* commands operating on string values */
|
178 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
179 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
180 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
181 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
182 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
183 |
-
|
184 |
-
/* commands operating on lists */
|
185 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
186 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
187 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
188 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
189 |
-
|
190 |
-
/* commands operating on sorted sets */
|
191 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
192 |
-
|
193 |
-
/* transactions */
|
194 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
195 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
196 |
-
|
197 |
-
/* remote server control commands */
|
198 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
199 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
200 |
-
|
201 |
-
/* ---------------- Redis 2.4 ---------------- */
|
202 |
-
|
203 |
-
/* remote server control commands */
|
204 |
-
'CLIENT' => 'Predis\Command\ServerClient',
|
205 |
-
);
|
206 |
-
}
|
207 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion260.php
DELETED
@@ -1,235 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 2.6.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion260 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '2.6';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
'DUMP' => 'Predis\Command\KeyDump',
|
51 |
-
'RESTORE' => 'Predis\Command\KeyRestore',
|
52 |
-
|
53 |
-
/* commands operating on string values */
|
54 |
-
'SET' => 'Predis\Command\StringSet',
|
55 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
56 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
57 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
58 |
-
'GET' => 'Predis\Command\StringGet',
|
59 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
60 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
61 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
62 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
63 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
64 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
65 |
-
|
66 |
-
/* commands operating on lists */
|
67 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
68 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
69 |
-
'LLEN' => 'Predis\Command\ListLength',
|
70 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
71 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
72 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
73 |
-
'LSET' => 'Predis\Command\ListSet',
|
74 |
-
'LREM' => 'Predis\Command\ListRemove',
|
75 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
76 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
77 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
78 |
-
|
79 |
-
/* commands operating on sets */
|
80 |
-
'SADD' => 'Predis\Command\SetAdd',
|
81 |
-
'SREM' => 'Predis\Command\SetRemove',
|
82 |
-
'SPOP' => 'Predis\Command\SetPop',
|
83 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
84 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
85 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
86 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
87 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
88 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
89 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
90 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
91 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
92 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
93 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
94 |
-
|
95 |
-
/* commands operating on sorted sets */
|
96 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
97 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
98 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
99 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
100 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
101 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
102 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
103 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
104 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
105 |
-
|
106 |
-
/* connection related commands */
|
107 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
108 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
109 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
110 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
111 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
112 |
-
|
113 |
-
/* remote server control commands */
|
114 |
-
'INFO' => 'Predis\Command\ServerInfoV26x',
|
115 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
116 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
117 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
118 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
119 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
120 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
121 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
122 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
123 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
124 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
125 |
-
|
126 |
-
/* ---------------- Redis 2.0 ---------------- */
|
127 |
-
|
128 |
-
/* commands operating on string values */
|
129 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
130 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
131 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
132 |
-
|
133 |
-
/* commands operating on lists */
|
134 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
135 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
136 |
-
|
137 |
-
/* commands operating on sorted sets */
|
138 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
139 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
140 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
141 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
142 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
143 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
144 |
-
|
145 |
-
/* commands operating on hashes */
|
146 |
-
'HSET' => 'Predis\Command\HashSet',
|
147 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
148 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
149 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
150 |
-
'HGET' => 'Predis\Command\HashGet',
|
151 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
152 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
153 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
154 |
-
'HLEN' => 'Predis\Command\HashLength',
|
155 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
156 |
-
'HVALS' => 'Predis\Command\HashValues',
|
157 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
158 |
-
|
159 |
-
/* transactions */
|
160 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
161 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
162 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
163 |
-
|
164 |
-
/* publish - subscribe */
|
165 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
166 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
167 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
168 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
169 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
170 |
-
|
171 |
-
/* remote server control commands */
|
172 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
173 |
-
|
174 |
-
/* ---------------- Redis 2.2 ---------------- */
|
175 |
-
|
176 |
-
/* commands operating on the key space */
|
177 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
178 |
-
|
179 |
-
/* commands operating on string values */
|
180 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
181 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
182 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
183 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
184 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
185 |
-
|
186 |
-
/* commands operating on lists */
|
187 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
188 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
189 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
190 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
191 |
-
|
192 |
-
/* commands operating on sorted sets */
|
193 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
194 |
-
|
195 |
-
/* transactions */
|
196 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
197 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
198 |
-
|
199 |
-
/* remote server control commands */
|
200 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
201 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
202 |
-
|
203 |
-
/* ---------------- Redis 2.4 ---------------- */
|
204 |
-
|
205 |
-
/* remote server control commands */
|
206 |
-
'CLIENT' => 'Predis\Command\ServerClient',
|
207 |
-
|
208 |
-
/* ---------------- Redis 2.6 ---------------- */
|
209 |
-
|
210 |
-
/* commands operating on the key space */
|
211 |
-
'PTTL' => 'Predis\Command\KeyPreciseTimeToLive',
|
212 |
-
'PEXPIRE' => 'Predis\Command\KeyPreciseExpire',
|
213 |
-
'PEXPIREAT' => 'Predis\Command\KeyPreciseExpireAt',
|
214 |
-
'MIGRATE' => 'Predis\Command\KeyMigrate',
|
215 |
-
|
216 |
-
/* commands operating on string values */
|
217 |
-
'PSETEX' => 'Predis\Command\StringPreciseSetExpire',
|
218 |
-
'INCRBYFLOAT' => 'Predis\Command\StringIncrementByFloat',
|
219 |
-
'BITOP' => 'Predis\Command\StringBitOp',
|
220 |
-
'BITCOUNT' => 'Predis\Command\StringBitCount',
|
221 |
-
|
222 |
-
/* commands operating on hashes */
|
223 |
-
'HINCRBYFLOAT' => 'Predis\Command\HashIncrementByFloat',
|
224 |
-
|
225 |
-
/* scripting */
|
226 |
-
'EVAL' => 'Predis\Command\ServerEval',
|
227 |
-
'EVALSHA' => 'Predis\Command\ServerEvalSHA',
|
228 |
-
'SCRIPT' => 'Predis\Command\ServerScript',
|
229 |
-
|
230 |
-
/* remote server control commands */
|
231 |
-
'TIME' => 'Predis\Command\ServerTime',
|
232 |
-
'SENTINEL' => 'Predis\Command\ServerSentinel',
|
233 |
-
);
|
234 |
-
}
|
235 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion280.php
DELETED
@@ -1,267 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 2.8.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion280 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '2.8';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
'DUMP' => 'Predis\Command\KeyDump',
|
51 |
-
'RESTORE' => 'Predis\Command\KeyRestore',
|
52 |
-
|
53 |
-
/* commands operating on string values */
|
54 |
-
'SET' => 'Predis\Command\StringSet',
|
55 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
56 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
57 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
58 |
-
'GET' => 'Predis\Command\StringGet',
|
59 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
60 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
61 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
62 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
63 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
64 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
65 |
-
|
66 |
-
/* commands operating on lists */
|
67 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
68 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
69 |
-
'LLEN' => 'Predis\Command\ListLength',
|
70 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
71 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
72 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
73 |
-
'LSET' => 'Predis\Command\ListSet',
|
74 |
-
'LREM' => 'Predis\Command\ListRemove',
|
75 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
76 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
77 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
78 |
-
|
79 |
-
/* commands operating on sets */
|
80 |
-
'SADD' => 'Predis\Command\SetAdd',
|
81 |
-
'SREM' => 'Predis\Command\SetRemove',
|
82 |
-
'SPOP' => 'Predis\Command\SetPop',
|
83 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
84 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
85 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
86 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
87 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
88 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
89 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
90 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
91 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
92 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
93 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
94 |
-
|
95 |
-
/* commands operating on sorted sets */
|
96 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
97 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
98 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
99 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
100 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
101 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
102 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
103 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
104 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
105 |
-
|
106 |
-
/* connection related commands */
|
107 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
108 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
109 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
110 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
111 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
112 |
-
|
113 |
-
/* remote server control commands */
|
114 |
-
'INFO' => 'Predis\Command\ServerInfoV26x',
|
115 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
116 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
117 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
118 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
119 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
120 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
121 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
122 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
123 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
124 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
125 |
-
|
126 |
-
/* ---------------- Redis 2.0 ---------------- */
|
127 |
-
|
128 |
-
/* commands operating on string values */
|
129 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
130 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
131 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
132 |
-
|
133 |
-
/* commands operating on lists */
|
134 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
135 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
136 |
-
|
137 |
-
/* commands operating on sorted sets */
|
138 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
139 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
140 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
141 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
142 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
143 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
144 |
-
|
145 |
-
/* commands operating on hashes */
|
146 |
-
'HSET' => 'Predis\Command\HashSet',
|
147 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
148 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
149 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
150 |
-
'HGET' => 'Predis\Command\HashGet',
|
151 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
152 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
153 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
154 |
-
'HLEN' => 'Predis\Command\HashLength',
|
155 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
156 |
-
'HVALS' => 'Predis\Command\HashValues',
|
157 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
158 |
-
|
159 |
-
/* transactions */
|
160 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
161 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
162 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
163 |
-
|
164 |
-
/* publish - subscribe */
|
165 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
166 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
167 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
168 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
169 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
170 |
-
|
171 |
-
/* remote server control commands */
|
172 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
173 |
-
|
174 |
-
/* ---------------- Redis 2.2 ---------------- */
|
175 |
-
|
176 |
-
/* commands operating on the key space */
|
177 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
178 |
-
|
179 |
-
/* commands operating on string values */
|
180 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
181 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
182 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
183 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
184 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
185 |
-
|
186 |
-
/* commands operating on lists */
|
187 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
188 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
189 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
190 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
191 |
-
|
192 |
-
/* commands operating on sorted sets */
|
193 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
194 |
-
|
195 |
-
/* transactions */
|
196 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
197 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
198 |
-
|
199 |
-
/* remote server control commands */
|
200 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
201 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
202 |
-
|
203 |
-
/* ---------------- Redis 2.4 ---------------- */
|
204 |
-
|
205 |
-
/* remote server control commands */
|
206 |
-
'CLIENT' => 'Predis\Command\ServerClient',
|
207 |
-
|
208 |
-
/* ---------------- Redis 2.6 ---------------- */
|
209 |
-
|
210 |
-
/* commands operating on the key space */
|
211 |
-
'PTTL' => 'Predis\Command\KeyPreciseTimeToLive',
|
212 |
-
'PEXPIRE' => 'Predis\Command\KeyPreciseExpire',
|
213 |
-
'PEXPIREAT' => 'Predis\Command\KeyPreciseExpireAt',
|
214 |
-
'MIGRATE' => 'Predis\Command\KeyMigrate',
|
215 |
-
|
216 |
-
/* commands operating on string values */
|
217 |
-
'PSETEX' => 'Predis\Command\StringPreciseSetExpire',
|
218 |
-
'INCRBYFLOAT' => 'Predis\Command\StringIncrementByFloat',
|
219 |
-
'BITOP' => 'Predis\Command\StringBitOp',
|
220 |
-
'BITCOUNT' => 'Predis\Command\StringBitCount',
|
221 |
-
|
222 |
-
/* commands operating on hashes */
|
223 |
-
'HINCRBYFLOAT' => 'Predis\Command\HashIncrementByFloat',
|
224 |
-
|
225 |
-
/* scripting */
|
226 |
-
'EVAL' => 'Predis\Command\ServerEval',
|
227 |
-
'EVALSHA' => 'Predis\Command\ServerEvalSHA',
|
228 |
-
'SCRIPT' => 'Predis\Command\ServerScript',
|
229 |
-
|
230 |
-
/* remote server control commands */
|
231 |
-
'TIME' => 'Predis\Command\ServerTime',
|
232 |
-
'SENTINEL' => 'Predis\Command\ServerSentinel',
|
233 |
-
|
234 |
-
/* ---------------- Redis 2.8 ---------------- */
|
235 |
-
|
236 |
-
/* commands operating on the key space */
|
237 |
-
'SCAN' => 'Predis\Command\KeyScan',
|
238 |
-
|
239 |
-
/* commands operating on string values */
|
240 |
-
'BITPOS' => 'Predis\Command\StringBitPos',
|
241 |
-
|
242 |
-
/* commands operating on sets */
|
243 |
-
'SSCAN' => 'Predis\Command\SetScan',
|
244 |
-
|
245 |
-
/* commands operating on sorted sets */
|
246 |
-
'ZSCAN' => 'Predis\Command\ZSetScan',
|
247 |
-
'ZLEXCOUNT' => 'Predis\Command\ZSetLexCount',
|
248 |
-
'ZRANGEBYLEX' => 'Predis\Command\ZSetRangeByLex',
|
249 |
-
'ZREMRANGEBYLEX' => 'Predis\Command\ZSetRemoveRangeByLex',
|
250 |
-
'ZREVRANGEBYLEX' => 'Predis\Command\ZSetReverseRangeByLex',
|
251 |
-
|
252 |
-
/* commands operating on hashes */
|
253 |
-
'HSCAN' => 'Predis\Command\HashScan',
|
254 |
-
|
255 |
-
/* publish - subscribe */
|
256 |
-
'PUBSUB' => 'Predis\Command\PubSubPubsub',
|
257 |
-
|
258 |
-
/* commands operating on HyperLogLog */
|
259 |
-
'PFADD' => 'Predis\Command\HyperLogLogAdd',
|
260 |
-
'PFCOUNT' => 'Predis\Command\HyperLogLogCount',
|
261 |
-
'PFMERGE' => 'Predis\Command\HyperLogLogMerge',
|
262 |
-
|
263 |
-
/* remote server control commands */
|
264 |
-
'COMMAND' => 'Predis\Command\ServerCommand',
|
265 |
-
);
|
266 |
-
}
|
267 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion300.php
DELETED
@@ -1,270 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 3.0.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion300 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '3.0';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
'DUMP' => 'Predis\Command\KeyDump',
|
51 |
-
'RESTORE' => 'Predis\Command\KeyRestore',
|
52 |
-
|
53 |
-
/* commands operating on string values */
|
54 |
-
'SET' => 'Predis\Command\StringSet',
|
55 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
56 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
57 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
58 |
-
'GET' => 'Predis\Command\StringGet',
|
59 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
60 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
61 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
62 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
63 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
64 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
65 |
-
|
66 |
-
/* commands operating on lists */
|
67 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
68 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
69 |
-
'LLEN' => 'Predis\Command\ListLength',
|
70 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
71 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
72 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
73 |
-
'LSET' => 'Predis\Command\ListSet',
|
74 |
-
'LREM' => 'Predis\Command\ListRemove',
|
75 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
76 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
77 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
78 |
-
|
79 |
-
/* commands operating on sets */
|
80 |
-
'SADD' => 'Predis\Command\SetAdd',
|
81 |
-
'SREM' => 'Predis\Command\SetRemove',
|
82 |
-
'SPOP' => 'Predis\Command\SetPop',
|
83 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
84 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
85 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
86 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
87 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
88 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
89 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
90 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
91 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
92 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
93 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
94 |
-
|
95 |
-
/* commands operating on sorted sets */
|
96 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
97 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
98 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
99 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
100 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
101 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
102 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
103 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
104 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
105 |
-
|
106 |
-
/* connection related commands */
|
107 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
108 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
109 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
110 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
111 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
112 |
-
|
113 |
-
/* remote server control commands */
|
114 |
-
'INFO' => 'Predis\Command\ServerInfoV26x',
|
115 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
116 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
117 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
118 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
119 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
120 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
121 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
122 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
123 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
124 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
125 |
-
|
126 |
-
/* ---------------- Redis 2.0 ---------------- */
|
127 |
-
|
128 |
-
/* commands operating on string values */
|
129 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
130 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
131 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
132 |
-
|
133 |
-
/* commands operating on lists */
|
134 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
135 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
136 |
-
|
137 |
-
/* commands operating on sorted sets */
|
138 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
139 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
140 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
141 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
142 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
143 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
144 |
-
|
145 |
-
/* commands operating on hashes */
|
146 |
-
'HSET' => 'Predis\Command\HashSet',
|
147 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
148 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
149 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
150 |
-
'HGET' => 'Predis\Command\HashGet',
|
151 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
152 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
153 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
154 |
-
'HLEN' => 'Predis\Command\HashLength',
|
155 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
156 |
-
'HVALS' => 'Predis\Command\HashValues',
|
157 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
158 |
-
|
159 |
-
/* transactions */
|
160 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
161 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
162 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
163 |
-
|
164 |
-
/* publish - subscribe */
|
165 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
166 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
167 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
168 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
169 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
170 |
-
|
171 |
-
/* remote server control commands */
|
172 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
173 |
-
|
174 |
-
/* ---------------- Redis 2.2 ---------------- */
|
175 |
-
|
176 |
-
/* commands operating on the key space */
|
177 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
178 |
-
|
179 |
-
/* commands operating on string values */
|
180 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
181 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
182 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
183 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
184 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
185 |
-
|
186 |
-
/* commands operating on lists */
|
187 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
188 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
189 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
190 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
191 |
-
|
192 |
-
/* commands operating on sorted sets */
|
193 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
194 |
-
|
195 |
-
/* transactions */
|
196 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
197 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
198 |
-
|
199 |
-
/* remote server control commands */
|
200 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
201 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
202 |
-
|
203 |
-
/* ---------------- Redis 2.4 ---------------- */
|
204 |
-
|
205 |
-
/* remote server control commands */
|
206 |
-
'CLIENT' => 'Predis\Command\ServerClient',
|
207 |
-
|
208 |
-
/* ---------------- Redis 2.6 ---------------- */
|
209 |
-
|
210 |
-
/* commands operating on the key space */
|
211 |
-
'PTTL' => 'Predis\Command\KeyPreciseTimeToLive',
|
212 |
-
'PEXPIRE' => 'Predis\Command\KeyPreciseExpire',
|
213 |
-
'PEXPIREAT' => 'Predis\Command\KeyPreciseExpireAt',
|
214 |
-
'MIGRATE' => 'Predis\Command\KeyMigrate',
|
215 |
-
|
216 |
-
/* commands operating on string values */
|
217 |
-
'PSETEX' => 'Predis\Command\StringPreciseSetExpire',
|
218 |
-
'INCRBYFLOAT' => 'Predis\Command\StringIncrementByFloat',
|
219 |
-
'BITOP' => 'Predis\Command\StringBitOp',
|
220 |
-
'BITCOUNT' => 'Predis\Command\StringBitCount',
|
221 |
-
|
222 |
-
/* commands operating on hashes */
|
223 |
-
'HINCRBYFLOAT' => 'Predis\Command\HashIncrementByFloat',
|
224 |
-
|
225 |
-
/* scripting */
|
226 |
-
'EVAL' => 'Predis\Command\ServerEval',
|
227 |
-
'EVALSHA' => 'Predis\Command\ServerEvalSHA',
|
228 |
-
'SCRIPT' => 'Predis\Command\ServerScript',
|
229 |
-
|
230 |
-
/* remote server control commands */
|
231 |
-
'TIME' => 'Predis\Command\ServerTime',
|
232 |
-
'SENTINEL' => 'Predis\Command\ServerSentinel',
|
233 |
-
|
234 |
-
/* ---------------- Redis 2.8 ---------------- */
|
235 |
-
|
236 |
-
/* commands operating on the key space */
|
237 |
-
'SCAN' => 'Predis\Command\KeyScan',
|
238 |
-
|
239 |
-
/* commands operating on string values */
|
240 |
-
'BITPOS' => 'Predis\Command\StringBitPos',
|
241 |
-
|
242 |
-
/* commands operating on sets */
|
243 |
-
'SSCAN' => 'Predis\Command\SetScan',
|
244 |
-
|
245 |
-
/* commands operating on sorted sets */
|
246 |
-
'ZSCAN' => 'Predis\Command\ZSetScan',
|
247 |
-
'ZLEXCOUNT' => 'Predis\Command\ZSetLexCount',
|
248 |
-
'ZRANGEBYLEX' => 'Predis\Command\ZSetRangeByLex',
|
249 |
-
'ZREMRANGEBYLEX' => 'Predis\Command\ZSetRemoveRangeByLex',
|
250 |
-
'ZREVRANGEBYLEX' => 'Predis\Command\ZSetReverseRangeByLex',
|
251 |
-
|
252 |
-
/* commands operating on hashes */
|
253 |
-
'HSCAN' => 'Predis\Command\HashScan',
|
254 |
-
|
255 |
-
/* publish - subscribe */
|
256 |
-
'PUBSUB' => 'Predis\Command\PubSubPubsub',
|
257 |
-
|
258 |
-
/* commands operating on HyperLogLog */
|
259 |
-
'PFADD' => 'Predis\Command\HyperLogLogAdd',
|
260 |
-
'PFCOUNT' => 'Predis\Command\HyperLogLogCount',
|
261 |
-
'PFMERGE' => 'Predis\Command\HyperLogLogMerge',
|
262 |
-
|
263 |
-
/* remote server control commands */
|
264 |
-
'COMMAND' => 'Predis\Command\ServerCommand',
|
265 |
-
|
266 |
-
/* ---------------- Redis 3.0 ---------------- */
|
267 |
-
|
268 |
-
);
|
269 |
-
}
|
270 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Profile/RedisVersion320.php
DELETED
@@ -1,281 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Predis package.
|
5 |
-
*
|
6 |
-
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Predis\Profile;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Server profile for Redis 3.0.
|
16 |
-
*
|
17 |
-
* @author Daniele Alessandri <suppakilla@gmail.com>
|
18 |
-
*/
|
19 |
-
class RedisVersion320 extends RedisProfile
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function getVersion()
|
25 |
-
{
|
26 |
-
return '3.2';
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getSupportedCommands()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
/* ---------------- Redis 1.2 ---------------- */
|
36 |
-
|
37 |
-
/* commands operating on the key space */
|
38 |
-
'EXISTS' => 'Predis\Command\KeyExists',
|
39 |
-
'DEL' => 'Predis\Command\KeyDelete',
|
40 |
-
'TYPE' => 'Predis\Command\KeyType',
|
41 |
-
'KEYS' => 'Predis\Command\KeyKeys',
|
42 |
-
'RANDOMKEY' => 'Predis\Command\KeyRandom',
|
43 |
-
'RENAME' => 'Predis\Command\KeyRename',
|
44 |
-
'RENAMENX' => 'Predis\Command\KeyRenamePreserve',
|
45 |
-
'EXPIRE' => 'Predis\Command\KeyExpire',
|
46 |
-
'EXPIREAT' => 'Predis\Command\KeyExpireAt',
|
47 |
-
'TTL' => 'Predis\Command\KeyTimeToLive',
|
48 |
-
'MOVE' => 'Predis\Command\KeyMove',
|
49 |
-
'SORT' => 'Predis\Command\KeySort',
|
50 |
-
'DUMP' => 'Predis\Command\KeyDump',
|
51 |
-
'RESTORE' => 'Predis\Command\KeyRestore',
|
52 |
-
|
53 |
-
/* commands operating on string values */
|
54 |
-
'SET' => 'Predis\Command\StringSet',
|
55 |
-
'SETNX' => 'Predis\Command\StringSetPreserve',
|
56 |
-
'MSET' => 'Predis\Command\StringSetMultiple',
|
57 |
-
'MSETNX' => 'Predis\Command\StringSetMultiplePreserve',
|
58 |
-
'GET' => 'Predis\Command\StringGet',
|
59 |
-
'MGET' => 'Predis\Command\StringGetMultiple',
|
60 |
-
'GETSET' => 'Predis\Command\StringGetSet',
|
61 |
-
'INCR' => 'Predis\Command\StringIncrement',
|
62 |
-
'INCRBY' => 'Predis\Command\StringIncrementBy',
|
63 |
-
'DECR' => 'Predis\Command\StringDecrement',
|
64 |
-
'DECRBY' => 'Predis\Command\StringDecrementBy',
|
65 |
-
|
66 |
-
/* commands operating on lists */
|
67 |
-
'RPUSH' => 'Predis\Command\ListPushTail',
|
68 |
-
'LPUSH' => 'Predis\Command\ListPushHead',
|
69 |
-
'LLEN' => 'Predis\Command\ListLength',
|
70 |
-
'LRANGE' => 'Predis\Command\ListRange',
|
71 |
-
'LTRIM' => 'Predis\Command\ListTrim',
|
72 |
-
'LINDEX' => 'Predis\Command\ListIndex',
|
73 |
-
'LSET' => 'Predis\Command\ListSet',
|
74 |
-
'LREM' => 'Predis\Command\ListRemove',
|
75 |
-
'LPOP' => 'Predis\Command\ListPopFirst',
|
76 |
-
'RPOP' => 'Predis\Command\ListPopLast',
|
77 |
-
'RPOPLPUSH' => 'Predis\Command\ListPopLastPushHead',
|
78 |
-
|
79 |
-
/* commands operating on sets */
|
80 |
-
'SADD' => 'Predis\Command\SetAdd',
|
81 |
-
'SREM' => 'Predis\Command\SetRemove',
|
82 |
-
'SPOP' => 'Predis\Command\SetPop',
|
83 |
-
'SMOVE' => 'Predis\Command\SetMove',
|
84 |
-
'SCARD' => 'Predis\Command\SetCardinality',
|
85 |
-
'SISMEMBER' => 'Predis\Command\SetIsMember',
|
86 |
-
'SINTER' => 'Predis\Command\SetIntersection',
|
87 |
-
'SINTERSTORE' => 'Predis\Command\SetIntersectionStore',
|
88 |
-
'SUNION' => 'Predis\Command\SetUnion',
|
89 |
-
'SUNIONSTORE' => 'Predis\Command\SetUnionStore',
|
90 |
-
'SDIFF' => 'Predis\Command\SetDifference',
|
91 |
-
'SDIFFSTORE' => 'Predis\Command\SetDifferenceStore',
|
92 |
-
'SMEMBERS' => 'Predis\Command\SetMembers',
|
93 |
-
'SRANDMEMBER' => 'Predis\Command\SetRandomMember',
|
94 |
-
|
95 |
-
/* commands operating on sorted sets */
|
96 |
-
'ZADD' => 'Predis\Command\ZSetAdd',
|
97 |
-
'ZINCRBY' => 'Predis\Command\ZSetIncrementBy',
|
98 |
-
'ZREM' => 'Predis\Command\ZSetRemove',
|
99 |
-
'ZRANGE' => 'Predis\Command\ZSetRange',
|
100 |
-
'ZREVRANGE' => 'Predis\Command\ZSetReverseRange',
|
101 |
-
'ZRANGEBYSCORE' => 'Predis\Command\ZSetRangeByScore',
|
102 |
-
'ZCARD' => 'Predis\Command\ZSetCardinality',
|
103 |
-
'ZSCORE' => 'Predis\Command\ZSetScore',
|
104 |
-
'ZREMRANGEBYSCORE' => 'Predis\Command\ZSetRemoveRangeByScore',
|
105 |
-
|
106 |
-
/* connection related commands */
|
107 |
-
'PING' => 'Predis\Command\ConnectionPing',
|
108 |
-
'AUTH' => 'Predis\Command\ConnectionAuth',
|
109 |
-
'SELECT' => 'Predis\Command\ConnectionSelect',
|
110 |
-
'ECHO' => 'Predis\Command\ConnectionEcho',
|
111 |
-
'QUIT' => 'Predis\Command\ConnectionQuit',
|
112 |
-
|
113 |
-
/* remote server control commands */
|
114 |
-
'INFO' => 'Predis\Command\ServerInfoV26x',
|
115 |
-
'SLAVEOF' => 'Predis\Command\ServerSlaveOf',
|
116 |
-
'MONITOR' => 'Predis\Command\ServerMonitor',
|
117 |
-
'DBSIZE' => 'Predis\Command\ServerDatabaseSize',
|
118 |
-
'FLUSHDB' => 'Predis\Command\ServerFlushDatabase',
|
119 |
-
'FLUSHALL' => 'Predis\Command\ServerFlushAll',
|
120 |
-
'SAVE' => 'Predis\Command\ServerSave',
|
121 |
-
'BGSAVE' => 'Predis\Command\ServerBackgroundSave',
|
122 |
-
'LASTSAVE' => 'Predis\Command\ServerLastSave',
|
123 |
-
'SHUTDOWN' => 'Predis\Command\ServerShutdown',
|
124 |
-
'BGREWRITEAOF' => 'Predis\Command\ServerBackgroundRewriteAOF',
|
125 |
-
|
126 |
-
/* ---------------- Redis 2.0 ---------------- */
|
127 |
-
|
128 |
-
/* commands operating on string values */
|
129 |
-
'SETEX' => 'Predis\Command\StringSetExpire',
|
130 |
-
'APPEND' => 'Predis\Command\StringAppend',
|
131 |
-
'SUBSTR' => 'Predis\Command\StringSubstr',
|
132 |
-
|
133 |
-
/* commands operating on lists */
|
134 |
-
'BLPOP' => 'Predis\Command\ListPopFirstBlocking',
|
135 |
-
'BRPOP' => 'Predis\Command\ListPopLastBlocking',
|
136 |
-
|
137 |
-
/* commands operating on sorted sets */
|
138 |
-
'ZUNIONSTORE' => 'Predis\Command\ZSetUnionStore',
|
139 |
-
'ZINTERSTORE' => 'Predis\Command\ZSetIntersectionStore',
|
140 |
-
'ZCOUNT' => 'Predis\Command\ZSetCount',
|
141 |
-
'ZRANK' => 'Predis\Command\ZSetRank',
|
142 |
-
'ZREVRANK' => 'Predis\Command\ZSetReverseRank',
|
143 |
-
'ZREMRANGEBYRANK' => 'Predis\Command\ZSetRemoveRangeByRank',
|
144 |
-
|
145 |
-
/* commands operating on hashes */
|
146 |
-
'HSET' => 'Predis\Command\HashSet',
|
147 |
-
'HSETNX' => 'Predis\Command\HashSetPreserve',
|
148 |
-
'HMSET' => 'Predis\Command\HashSetMultiple',
|
149 |
-
'HINCRBY' => 'Predis\Command\HashIncrementBy',
|
150 |
-
'HGET' => 'Predis\Command\HashGet',
|
151 |
-
'HMGET' => 'Predis\Command\HashGetMultiple',
|
152 |
-
'HDEL' => 'Predis\Command\HashDelete',
|
153 |
-
'HEXISTS' => 'Predis\Command\HashExists',
|
154 |
-
'HLEN' => 'Predis\Command\HashLength',
|
155 |
-
'HKEYS' => 'Predis\Command\HashKeys',
|
156 |
-
'HVALS' => 'Predis\Command\HashValues',
|
157 |
-
'HGETALL' => 'Predis\Command\HashGetAll',
|
158 |
-
|
159 |
-
/* transactions */
|
160 |
-
'MULTI' => 'Predis\Command\TransactionMulti',
|
161 |
-
'EXEC' => 'Predis\Command\TransactionExec',
|
162 |
-
'DISCARD' => 'Predis\Command\TransactionDiscard',
|
163 |
-
|
164 |
-
/* publish - subscribe */
|
165 |
-
'SUBSCRIBE' => 'Predis\Command\PubSubSubscribe',
|
166 |
-
'UNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribe',
|
167 |
-
'PSUBSCRIBE' => 'Predis\Command\PubSubSubscribeByPattern',
|
168 |
-
'PUNSUBSCRIBE' => 'Predis\Command\PubSubUnsubscribeByPattern',
|
169 |
-
'PUBLISH' => 'Predis\Command\PubSubPublish',
|
170 |
-
|
171 |
-
/* remote server control commands */
|
172 |
-
'CONFIG' => 'Predis\Command\ServerConfig',
|
173 |
-
|
174 |
-
/* ---------------- Redis 2.2 ---------------- */
|
175 |
-
|
176 |
-
/* commands operating on the key space */
|
177 |
-
'PERSIST' => 'Predis\Command\KeyPersist',
|
178 |
-
|
179 |
-
/* commands operating on string values */
|
180 |
-
'STRLEN' => 'Predis\Command\StringStrlen',
|
181 |
-
'SETRANGE' => 'Predis\Command\StringSetRange',
|
182 |
-
'GETRANGE' => 'Predis\Command\StringGetRange',
|
183 |
-
'SETBIT' => 'Predis\Command\StringSetBit',
|
184 |
-
'GETBIT' => 'Predis\Command\StringGetBit',
|
185 |
-
|
186 |
-
/* commands operating on lists */
|
187 |
-
'RPUSHX' => 'Predis\Command\ListPushTailX',
|
188 |
-
'LPUSHX' => 'Predis\Command\ListPushHeadX',
|
189 |
-
'LINSERT' => 'Predis\Command\ListInsert',
|
190 |
-
'BRPOPLPUSH' => 'Predis\Command\ListPopLastPushHeadBlocking',
|
191 |
-
|
192 |
-
/* commands operating on sorted sets */
|
193 |
-
'ZREVRANGEBYSCORE' => 'Predis\Command\ZSetReverseRangeByScore',
|
194 |
-
|
195 |
-
/* transactions */
|
196 |
-
'WATCH' => 'Predis\Command\TransactionWatch',
|
197 |
-
'UNWATCH' => 'Predis\Command\TransactionUnwatch',
|
198 |
-
|
199 |
-
/* remote server control commands */
|
200 |
-
'OBJECT' => 'Predis\Command\ServerObject',
|
201 |
-
'SLOWLOG' => 'Predis\Command\ServerSlowlog',
|
202 |
-
|
203 |
-
/* ---------------- Redis 2.4 ---------------- */
|
204 |
-
|
205 |
-
/* remote server control commands */
|
206 |
-
'CLIENT' => 'Predis\Command\ServerClient',
|
207 |
-
|
208 |
-
/* ---------------- Redis 2.6 ---------------- */
|
209 |
-
|
210 |
-
/* commands operating on the key space */
|
211 |
-
'PTTL' => 'Predis\Command\KeyPreciseTimeToLive',
|
212 |
-
'PEXPIRE' => 'Predis\Command\KeyPreciseExpire',
|
213 |
-
'PEXPIREAT' => 'Predis\Command\KeyPreciseExpireAt',
|
214 |
-
'MIGRATE' => 'Predis\Command\KeyMigrate',
|
215 |
-
|
216 |
-
/* commands operating on string values */
|
217 |
-
'PSETEX' => 'Predis\Command\StringPreciseSetExpire',
|
218 |
-
'INCRBYFLOAT' => 'Predis\Command\StringIncrementByFloat',
|
219 |
-
'BITOP' => 'Predis\Command\StringBitOp',
|
220 |
-
'BITCOUNT' => 'Predis\Command\StringBitCount',
|
221 |
-
|
222 |
-
/* commands operating on hashes */
|
223 |
-
'HINCRBYFLOAT' => 'Predis\Command\HashIncrementByFloat',
|
224 |
-
|
225 |
-
/* scripting */
|
226 |
-
'EVAL' => 'Predis\Command\ServerEval',
|
227 |
-
'EVALSHA' => 'Predis\Command\ServerEvalSHA',
|
228 |
-
'SCRIPT' => 'Predis\Command\ServerScript',
|
229 |
-
|
230 |
-
/* remote server control commands */
|
231 |
-
'TIME' => 'Predis\Command\ServerTime',
|
232 |
-
'SENTINEL' => 'Predis\Command\ServerSentinel',
|
233 |
-
|
234 |
-
/* ---------------- Redis 2.8 ---------------- */
|
235 |
-
|
236 |
-
/* commands operating on the key space */
|
237 |
-
'SCAN' => 'Predis\Command\KeyScan',
|
238 |
-
|
239 |
-
/* commands operating on string values */
|
240 |
-
'BITPOS' => 'Predis\Command\StringBitPos',
|
241 |
-
|
242 |
-
/* commands operating on sets */
|
243 |
-
'SSCAN' => 'Predis\Command\SetScan',
|
244 |
-
|
245 |
-
/* commands operating on sorted sets */
|
246 |
-
'ZSCAN' => 'Predis\Command\ZSetScan',
|
247 |
-
'ZLEXCOUNT' => 'Predis\Command\ZSetLexCount',
|
248 |
-
'ZRANGEBYLEX' => 'Predis\Command\ZSetRangeByLex',
|
249 |
-
'ZREMRANGEBYLEX' => 'Predis\Command\ZSetRemoveRangeByLex',
|
250 |
-
'ZREVRANGEBYLEX' => 'Predis\Command\ZSetReverseRangeByLex',
|
251 |
-
|
252 |
-
/* commands operating on hashes */
|
253 |
-
'HSCAN' => 'Predis\Command\HashScan',
|
254 |
-
|
255 |
-
/* publish - subscribe */
|
256 |
-
'PUBSUB' => 'Predis\Command\PubSubPubsub',
|
257 |
-
|
258 |
-
/* commands operating on HyperLogLog */
|
259 |
-
'PFADD' => 'Predis\Command\HyperLogLogAdd',
|
260 |
-
'PFCOUNT' => 'Predis\Command\HyperLogLogCount',
|
261 |
-
'PFMERGE' => 'Predis\Command\HyperLogLogMerge',
|
262 |
-
|
263 |
-
/* remote server control commands */
|
264 |
-
'COMMAND' => 'Predis\Command\ServerCommand',
|
265 |
-
|
266 |
-
/* ---------------- Redis 3.2 ---------------- */
|
267 |
-
|
268 |
-
/* commands operating on hashes */
|
269 |
-
'HSTRLEN' => 'Predis\Command\HashStringLength',
|
270 |
-
'BITFIELD' => 'Predis\Command\StringBitField',
|
271 |
-
|
272 |
-
/* commands performing geospatial operations */
|
273 |
-
'GEOADD' => 'Predis\Command\GeospatialGeoAdd',
|
274 |
-
'GEOHASH' => 'Predis\Command\GeospatialGeoHash',
|
275 |
-
'GEOPOS' => 'Predis\Command\GeospatialGeoPos',
|
276 |
-
'GEODIST' => 'Predis\Command\GeospatialGeoDist',
|
277 |
-
'GEORADIUS' => 'Predis\Command\GeospatialGeoRadius',
|
278 |
-
'GEORADIUSBYMEMBER' => 'Predis\Command\GeospatialGeoRadiusByMember',
|
279 |
-
);
|
280 |
-
}
|
281 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/src/Protocol/ProtocolException.php
CHANGED
@@ -14,7 +14,7 @@ namespace Predis\Protocol;
|
|
14 |
use Predis\CommunicationException;
|
15 |
|
16 |
/**
|
17 |
-
* Exception used to
|
18 |
* protocol.
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
14 |
use Predis\CommunicationException;
|
15 |
|
16 |
/**
|
17 |
+
* Exception used to identify errors encountered while parsing the Redis wire
|
18 |
* protocol.
|
19 |
*
|
20 |
* @author Daniele Alessandri <suppakilla@gmail.com>
|
dependencies/predis/predis/src/Protocol/Text/Handler/BulkResponse.php
CHANGED
@@ -34,7 +34,7 @@ class BulkResponse implements ResponseHandlerInterface
|
|
34 |
|
35 |
if ("$length" !== $payload) {
|
36 |
CommunicationException::handle(new ProtocolException(
|
37 |
-
$connection, "Cannot parse '$payload' as a valid length for a bulk response
|
38 |
));
|
39 |
}
|
40 |
|
@@ -47,7 +47,7 @@ class BulkResponse implements ResponseHandlerInterface
|
|
47 |
}
|
48 |
|
49 |
CommunicationException::handle(new ProtocolException(
|
50 |
-
$connection, "Value '$payload' is not a valid length for a bulk response
|
51 |
));
|
52 |
|
53 |
return;
|
34 |
|
35 |
if ("$length" !== $payload) {
|
36 |
CommunicationException::handle(new ProtocolException(
|
37 |
+
$connection, "Cannot parse '$payload' as a valid length for a bulk response [{$connection->getParameters()}]"
|
38 |
));
|
39 |
}
|
40 |
|
47 |
}
|
48 |
|
49 |
CommunicationException::handle(new ProtocolException(
|
50 |
+
$connection, "Value '$payload' is not a valid length for a bulk response [{$connection->getParameters()}]"
|
51 |
));
|
52 |
|
53 |
return;
|
dependencies/predis/predis/src/Protocol/Text/Handler/IntegerResponse.php
CHANGED
@@ -32,12 +32,13 @@ class IntegerResponse implements ResponseHandlerInterface
|
|
32 |
{
|
33 |
if (is_numeric($payload)) {
|
34 |
$integer = (int) $payload;
|
|
|
35 |
return $integer == $payload ? $integer : $payload;
|
36 |
}
|
37 |
|
38 |
if ($payload !== 'nil') {
|
39 |
CommunicationException::handle(new ProtocolException(
|
40 |
-
$connection, "Cannot parse '$payload' as a valid numeric response
|
41 |
));
|
42 |
}
|
43 |
|
32 |
{
|
33 |
if (is_numeric($payload)) {
|
34 |
$integer = (int) $payload;
|
35 |
+
|
36 |
return $integer == $payload ? $integer : $payload;
|
37 |
}
|
38 |
|
39 |
if ($payload !== 'nil') {
|
40 |
CommunicationException::handle(new ProtocolException(
|
41 |
+
$connection, "Cannot parse '$payload' as a valid numeric response [{$connection->getParameters()}]"
|
42 |
));
|
43 |
}
|
44 |
|
dependencies/predis/predis/src/Protocol/Text/Handler/MultiBulkResponse.php
CHANGED
@@ -34,7 +34,7 @@ class MultiBulkResponse implements ResponseHandlerInterface
|
|
34 |
|
35 |
if ("$length" !== $payload) {
|
36 |
CommunicationException::handle(new ProtocolException(
|
37 |
-
$connection, "Cannot parse '$payload' as a valid length of a multi-bulk response
|
38 |
));
|
39 |
}
|
40 |
|
34 |
|
35 |
if ("$length" !== $payload) {
|
36 |
CommunicationException::handle(new ProtocolException(
|
37 |
+
$connection, "Cannot parse '$payload' as a valid length of a multi-bulk response [{$connection->getParameters()}]"
|
38 |
));
|
39 |
}
|
40 |
|
dependencies/predis/predis/src/Protocol/Text/Handler/StreamableMultiBulkResponse.php
CHANGED
@@ -38,7 +38,7 @@ class StreamableMultiBulkResponse implements ResponseHandlerInterface
|
|
38 |
|
39 |
if ("$length" != $payload) {
|
40 |
CommunicationException::handle(new ProtocolException(
|
41 |
-
$connection, "Cannot parse '$payload' as a valid length for a multi-bulk response
|
42 |
));
|
43 |
}
|
44 |
|
38 |
|
39 |
if ("$length" != $payload) {
|
40 |
CommunicationException::handle(new ProtocolException(
|
41 |
+
$connection, "Cannot parse '$payload' as a valid length for a multi-bulk response [{$connection->getParameters()}]"
|
42 |
));
|
43 |
}
|
44 |
|
dependencies/predis/predis/src/Protocol/Text/ProtocolProcessor.php
CHANGED
@@ -91,6 +91,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface
|
|
91 |
|
92 |
case ':':
|
93 |
$integer = (int) $payload;
|
|
|
94 |
return $integer == $payload ? $integer : $payload;
|
95 |
|
96 |
case '-':
|
@@ -98,7 +99,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface
|
|
98 |
|
99 |
default:
|
100 |
CommunicationException::handle(new ProtocolException(
|
101 |
-
$connection, "Unknown response prefix: '$prefix'
|
102 |
));
|
103 |
|
104 |
return;
|
91 |
|
92 |
case ':':
|
93 |
$integer = (int) $payload;
|
94 |
+
|
95 |
return $integer == $payload ? $integer : $payload;
|
96 |
|
97 |
case '-':
|
99 |
|
100 |
default:
|
101 |
CommunicationException::handle(new ProtocolException(
|
102 |
+
$connection, "Unknown response prefix: '$prefix' [{$connection->getParameters()}]"
|
103 |
));
|
104 |
|
105 |
return;
|
dependencies/predis/predis/src/Protocol/Text/ResponseReader.php
CHANGED
@@ -86,18 +86,16 @@ class ResponseReader implements ResponseReaderInterface
|
|
86 |
$header = $connection->readLine();
|
87 |
|
88 |
if ($header === '') {
|
89 |
-
$this->onProtocolError($connection, 'Unexpected empty reponse header
|
90 |
}
|
91 |
|
92 |
$prefix = $header[0];
|
93 |
|
94 |
if (!isset($this->handlers[$prefix])) {
|
95 |
-
$this->onProtocolError($connection, "Unknown response prefix: '$prefix'
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
return $payload;
|
101 |
}
|
102 |
|
103 |
/**
|
@@ -110,7 +108,7 @@ class ResponseReader implements ResponseReaderInterface
|
|
110 |
protected function onProtocolError(CompositeConnectionInterface $connection, $message)
|
111 |
{
|
112 |
CommunicationException::handle(
|
113 |
-
new ProtocolException($connection, $message)
|
114 |
);
|
115 |
}
|
116 |
}
|
86 |
$header = $connection->readLine();
|
87 |
|
88 |
if ($header === '') {
|
89 |
+
$this->onProtocolError($connection, 'Unexpected empty reponse header');
|
90 |
}
|
91 |
|
92 |
$prefix = $header[0];
|
93 |
|
94 |
if (!isset($this->handlers[$prefix])) {
|
95 |
+
$this->onProtocolError($connection, "Unknown response prefix: '$prefix'");
|
96 |
}
|
97 |
|
98 |
+
return $this->handlers[$prefix]->handle($connection, substr($header, 1));
|
|
|
|
|
99 |
}
|
100 |
|
101 |
/**
|
108 |
protected function onProtocolError(CompositeConnectionInterface $connection, $message)
|
109 |
{
|
110 |
CommunicationException::handle(
|
111 |
+
new ProtocolException($connection, "$message [{$connection->getParameters()}]")
|
112 |
);
|
113 |
}
|
114 |
}
|
dependencies/predis/predis/src/PubSub/Consumer.php
CHANGED
@@ -14,7 +14,7 @@ namespace Predis\PubSub;
|
|
14 |
use Predis\ClientException;
|
15 |
use Predis\ClientInterface;
|
16 |
use Predis\Command\Command;
|
17 |
-
use Predis\Connection\
|
18 |
use Predis\NotSupportedException;
|
19 |
|
20 |
/**
|
@@ -62,17 +62,17 @@ class Consumer extends AbstractConsumer
|
|
62 |
*/
|
63 |
private function checkCapabilities(ClientInterface $client)
|
64 |
{
|
65 |
-
if ($client->getConnection() instanceof
|
66 |
throw new NotSupportedException(
|
67 |
-
'Cannot initialize a PUB/SUB consumer over
|
68 |
);
|
69 |
}
|
70 |
|
71 |
$commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
|
72 |
|
73 |
-
if (
|
74 |
throw new NotSupportedException(
|
75 |
-
'
|
76 |
);
|
77 |
}
|
78 |
}
|
14 |
use Predis\ClientException;
|
15 |
use Predis\ClientInterface;
|
16 |
use Predis\Command\Command;
|
17 |
+
use Predis\Connection\Cluster\ClusterInterface;
|
18 |
use Predis\NotSupportedException;
|
19 |
|
20 |
/**
|
62 |
*/
|
63 |
private function checkCapabilities(ClientInterface $client)
|
64 |
{
|
65 |
+
if ($client->getConnection() instanceof ClusterInterface) {
|
66 |
throw new NotSupportedException(
|
67 |
+
'Cannot initialize a PUB/SUB consumer over cluster connections.'
|
68 |
);
|
69 |
}
|
70 |
|
71 |
$commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
|
72 |
|
73 |
+
if (!$client->getCommandFactory()->supports(...$commands)) {
|
74 |
throw new NotSupportedException(
|
75 |
+
'PUB/SUB commands are not supported by the current command factory.'
|
76 |
);
|
77 |
}
|
78 |
}
|
dependencies/predis/predis/src/PubSub/DispatcherLoop.php
CHANGED
@@ -128,7 +128,7 @@ class DispatcherLoop
|
|
128 |
if ($kind !== Consumer::MESSAGE && $kind !== Consumer::PMESSAGE) {
|
129 |
if (isset($this->subscriptionCallback)) {
|
130 |
$callback = $this->subscriptionCallback;
|
131 |
-
call_user_func($callback, $message);
|
132 |
}
|
133 |
|
134 |
continue;
|
@@ -136,10 +136,10 @@ class DispatcherLoop
|
|
136 |
|
137 |
if (isset($this->callbacks[$message->channel])) {
|
138 |
$callback = $this->callbacks[$message->channel];
|
139 |
-
call_user_func($callback, $message->payload);
|
140 |
} elseif (isset($this->defaultCallback)) {
|
141 |
$callback = $this->defaultCallback;
|
142 |
-
call_user_func($callback, $message);
|
143 |
}
|
144 |
}
|
145 |
}
|
128 |
if ($kind !== Consumer::MESSAGE && $kind !== Consumer::PMESSAGE) {
|
129 |
if (isset($this->subscriptionCallback)) {
|
130 |
$callback = $this->subscriptionCallback;
|
131 |
+
call_user_func($callback, $message, $this);
|
132 |
}
|
133 |
|
134 |
continue;
|
136 |
|
137 |
if (isset($this->callbacks[$message->channel])) {
|
138 |
$callback = $this->callbacks[$message->channel];
|
139 |
+
call_user_func($callback, $message->payload, $this);
|
140 |
} elseif (isset($this->defaultCallback)) {
|
141 |
$callback = $this->defaultCallback;
|
142 |
+
call_user_func($callback, $message, $this);
|
143 |
}
|
144 |
}
|
145 |
}
|
dependencies/predis/predis/src/Response/Status.php
CHANGED
@@ -59,7 +59,7 @@ class Status implements ResponseInterface
|
|
59 |
*
|
60 |
* @param string $payload Status response payload.
|
61 |
*
|
62 |
-
* @return
|
63 |
*/
|
64 |
public static function get($payload)
|
65 |
{
|
59 |
*
|
60 |
* @param string $payload Status response payload.
|
61 |
*
|
62 |
+
* @return self
|
63 |
*/
|
64 |
public static function get($payload)
|
65 |
{
|
dependencies/predis/predis/src/Session/Handler.php
CHANGED
@@ -48,18 +48,7 @@ class Handler implements \SessionHandlerInterface
|
|
48 |
*/
|
49 |
public function register()
|
50 |
{
|
51 |
-
|
52 |
-
session_set_save_handler($this, true);
|
53 |
-
} else {
|
54 |
-
session_set_save_handler(
|
55 |
-
array($this, 'open'),
|
56 |
-
array($this, 'close'),
|
57 |
-
array($this, 'read'),
|
58 |
-
array($this, 'write'),
|
59 |
-
array($this, 'destroy'),
|
60 |
-
array($this, 'gc')
|
61 |
-
);
|
62 |
-
}
|
63 |
}
|
64 |
|
65 |
/**
|
48 |
*/
|
49 |
public function register()
|
50 |
{
|
51 |
+
session_set_save_handler($this, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
dependencies/predis/predis/src/Transaction/AbortedMultiExecException.php
CHANGED
@@ -27,9 +27,10 @@ class AbortedMultiExecException extends PredisException
|
|
27 |
* @param string $message Error message.
|
28 |
* @param int $code Error code.
|
29 |
*/
|
30 |
-
public function __construct(MultiExec $transaction, $message, $code =
|
31 |
{
|
32 |
parent::__construct($message, is_null($code) ? 0 : $code);
|
|
|
33 |
$this->transaction = $transaction;
|
34 |
}
|
35 |
|
27 |
* @param string $message Error message.
|
28 |
* @param int $code Error code.
|
29 |
*/
|
30 |
+
public function __construct(MultiExec $transaction, $message, $code = 0)
|
31 |
{
|
32 |
parent::__construct($message, is_null($code) ? 0 : $code);
|
33 |
+
|
34 |
$this->transaction = $transaction;
|
35 |
}
|
36 |
|
dependencies/predis/predis/src/Transaction/MultiExec.php
CHANGED
@@ -16,7 +16,7 @@ use Predis\ClientException;
|
|
16 |
use Predis\ClientInterface;
|
17 |
use Predis\Command\CommandInterface;
|
18 |
use Predis\CommunicationException;
|
19 |
-
use Predis\Connection\
|
20 |
use Predis\NotSupportedException;
|
21 |
use Predis\Protocol\ProtocolException;
|
22 |
use Predis\Response\ErrorInterface as ErrorResponseInterface;
|
@@ -66,15 +66,15 @@ class MultiExec implements ClientContextInterface
|
|
66 |
*/
|
67 |
private function assertClient(ClientInterface $client)
|
68 |
{
|
69 |
-
if ($client->getConnection() instanceof
|
70 |
throw new NotSupportedException(
|
71 |
-
'Cannot initialize a MULTI/EXEC transaction over
|
72 |
);
|
73 |
}
|
74 |
|
75 |
-
if (!$client->
|
76 |
throw new NotSupportedException(
|
77 |
-
'
|
78 |
);
|
79 |
}
|
80 |
}
|
@@ -228,8 +228,8 @@ class MultiExec implements ClientContextInterface
|
|
228 |
*/
|
229 |
public function watch($keys)
|
230 |
{
|
231 |
-
if (!$this->client->
|
232 |
-
throw new NotSupportedException('WATCH is not supported by the current
|
233 |
}
|
234 |
|
235 |
if ($this->state->isWatchAllowed()) {
|
@@ -268,9 +268,9 @@ class MultiExec implements ClientContextInterface
|
|
268 |
*/
|
269 |
public function unwatch()
|
270 |
{
|
271 |
-
if (!$this->client->
|
272 |
throw new NotSupportedException(
|
273 |
-
'UNWATCH is not supported by the current
|
274 |
);
|
275 |
}
|
276 |
|
16 |
use Predis\ClientInterface;
|
17 |
use Predis\Command\CommandInterface;
|
18 |
use Predis\CommunicationException;
|
19 |
+
use Predis\Connection\Cluster\ClusterInterface;
|
20 |
use Predis\NotSupportedException;
|
21 |
use Predis\Protocol\ProtocolException;
|
22 |
use Predis\Response\ErrorInterface as ErrorResponseInterface;
|
66 |
*/
|
67 |
private function assertClient(ClientInterface $client)
|
68 |
{
|
69 |
+
if ($client->getConnection() instanceof ClusterInterface) {
|
70 |
throw new NotSupportedException(
|
71 |
+
'Cannot initialize a MULTI/EXEC transaction over cluster connections.'
|
72 |
);
|
73 |
}
|
74 |
|
75 |
+
if (!$client->getCommandFactory()->supports('MULTI', 'EXEC', 'DISCARD')) {
|
76 |
throw new NotSupportedException(
|
77 |
+
'MULTI, EXEC and DISCARD are not supported by the current command factory.'
|
78 |
);
|
79 |
}
|
80 |
}
|
228 |
*/
|
229 |
public function watch($keys)
|
230 |
{
|
231 |
+
if (!$this->client->getCommandFactory()->supports('WATCH')) {
|
232 |
+
throw new NotSupportedException('WATCH is not supported by the current command factory.');
|
233 |
}
|
234 |
|
235 |
if ($this->state->isWatchAllowed()) {
|
268 |
*/
|
269 |
public function unwatch()
|
270 |
{
|
271 |
+
if (!$this->client->getCommandFactory()->supports('UNWATCH')) {
|
272 |
throw new NotSupportedException(
|
273 |
+
'UNWATCH is not supported by the current command factory.'
|
274 |
);
|
275 |
}
|
276 |
|
dependencies/predis/predis/tests/README.md
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
# About testing Predis #
|
2 |
-
|
3 |
-
__ATTENTION__: Do not ever ever run this test suite against instances of Redis running in production
|
4 |
-
environments or containing data you are interested in! If you still want to test this library on a
|
5 |
-
production server without hitting the database, please read ahead about how to disable integration
|
6 |
-
tests.
|
7 |
-
|
8 |
-
Predis ships a comprehensive test suite that uses __PHPUnit__ to cover every aspect of the library.
|
9 |
-
The suite is organized into several unit groups with the PHPUnit `@group` annotation which makes it
|
10 |
-
possible to run only selected groups of tests. The main groups are:
|
11 |
-
|
12 |
-
- __disconnected__: generic tests verifying the correct behaviour of the library without requiring
|
13 |
-
an active connection to Redis.
|
14 |
-
- __connected__: integration tests that require an active connection to Redis
|
15 |
-
- __commands__: tests for the implementation of Redis commands.
|
16 |
-
- __slow__: tests that might slow down the execution of the test suite (either __connected__ or
|
17 |
-
__disconnected__).
|
18 |
-
|
19 |
-
A list of all the available groups in the suite can be obtained by running:
|
20 |
-
|
21 |
-
```bash
|
22 |
-
$ phpunit --list-groups
|
23 |
-
```
|
24 |
-
|
25 |
-
Groups of tests can be disabled or enabled via the XML configuration file or the standard command
|
26 |
-
line test runner. Please note that due to a bug in PHPUnit, older versions ignore the `--group`
|
27 |
-
option when the group is excluded in the XML configuration file. More details about this issue are
|
28 |
-
available on [PHPUnit's bug tracker](http://github.com/sebastianbergmann/phpunit/issues/320).
|
29 |
-
|
30 |
-
Certain groups of tests requiring native extensions, such as `ext-curl` or `ext-phpiredis`, are
|
31 |
-
disabled by default in the configuration file. To enable these groups of tests you should remove
|
32 |
-
them from the exclusion list in `phpunit.xml`.
|
33 |
-
|
34 |
-
### Combining groups for inclusion or exclusion with the command-line runner ###
|
35 |
-
|
36 |
-
```bash
|
37 |
-
$ phpunit --group disconnected --exclude-group commands,slow
|
38 |
-
```
|
39 |
-
|
40 |
-
### Integration tests ###
|
41 |
-
|
42 |
-
The suite performs integration tests against a running instance of Redis (>= 2.4.0) to verify the
|
43 |
-
correct behavior of the implementation of each command and certain abstractions implemented in the
|
44 |
-
library that depend on them. These tests are identified by the __connected__ group.
|
45 |
-
|
46 |
-
Integration tests for commands that are not defined in the specified server profile (see the value
|
47 |
-
of the `REDIS_SERVER_VERSION` constant in `phpunit.xml`) are marked as __skipped__ automatically.
|
48 |
-
|
49 |
-
By default, the test suite is configured to execute integration tests using the server profile for
|
50 |
-
Redis 3.2. You can run the suite against a Redis instance built from the `unstable` branch with the
|
51 |
-
development profile by changing the `REDIS_SERVER_VERSION` to `dev` in the `phpunit.xml` file.
|
52 |
-
|
53 |
-
If you do not have a Redis instance up and running or available for testing, you can completely
|
54 |
-
disable integration tests by excluding the __connected__ group:
|
55 |
-
|
56 |
-
```bash
|
57 |
-
$ phpunit --exclude-group connected
|
58 |
-
```
|
59 |
-
|
60 |
-
### Slow tests ###
|
61 |
-
|
62 |
-
Certain tests can slow down the execution of the suite. These tests can be disabled by excluding the
|
63 |
-
__slow__ group:
|
64 |
-
|
65 |
-
```bash
|
66 |
-
$ phpunit --exclude-group slow
|
67 |
-
```
|
68 |
-
|
69 |
-
### Testing Redis commands ###
|
70 |
-
|
71 |
-
We also provide an helper script in the `bin` directory that can be used to automatically generate a
|
72 |
-
file with the skeleton of a test case to test a Redis command by specifying the name of the class
|
73 |
-
in the `Predis\Command` namespace (only classes in this namespace are considered valid). For example
|
74 |
-
to generate a test case for `SET` (represented by the `Predis\Command\StringSet` class):
|
75 |
-
|
76 |
-
```bash
|
77 |
-
$ ./bin/create-command-test --class=StringSet
|
78 |
-
```
|
79 |
-
|
80 |
-
Each command has its own realm (e.g. commands operating on strings, lists, sets and such) which is
|
81 |
-
automatically inferred from the name of the specified class. The realm can be also provided manually
|
82 |
-
leveraging the `--realm` option.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/tests/apply-patches.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Apply patches to support newer PHP versions.
|
4 |
-
*/
|
5 |
-
|
6 |
-
$patches = array(
|
7 |
-
'phpunit_mock_objects.patch' => 'phpunit/phpunit-mock-objects',
|
8 |
-
'phpunit_php7.patch' => 'phpunit/phpunit',
|
9 |
-
'phpunit_php8.patch' => 'phpunit/phpunit',
|
10 |
-
'phpunit_php81.patch' => 'phpunit/phpunit',
|
11 |
-
);
|
12 |
-
|
13 |
-
foreach ($patches as $patch => $package) {
|
14 |
-
chdir(__DIR__.'/../vendor/'.$package);
|
15 |
-
passthru(sprintf('patch -p1 -f < ../../../tests/%s', $patch));
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/tests/phpunit_mock_objects.patch
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
|
2 |
-
index 3df3abb..fc76d5d 100644
|
3 |
-
--- a/src/Framework/MockObject/Generator.php
|
4 |
-
+++ b/src/Framework/MockObject/Generator.php
|
5 |
-
@@ -1031,16 +1031,29 @@ protected function getMethodParameters(ReflectionMethod $method, $forCall = fals
|
6 |
-
$typeDeclaration = '';
|
7 |
-
|
8 |
-
if (!$forCall) {
|
9 |
-
+ if (PHP_VERSION_ID >= 80000) {
|
10 |
-
+ $isArray = $parameter->getType() && $parameter->getType()->getName() === 'array';
|
11 |
-
+ $isCallable = $parameter->getType() && $parameter->getType()->getName() === 'callable';
|
12 |
-
+ } else {
|
13 |
-
+ $isArray = $parameter->isArray();
|
14 |
-
+ $isCallable = version_compare(PHP_VERSION, '5.4.0', '>=') ? $parameter->isCallable() : false;
|
15 |
-
+ }
|
16 |
-
+
|
17 |
-
if ($this->hasType($parameter)) {
|
18 |
-
- $typeDeclaration = (string) $parameter->getType() . ' ';
|
19 |
-
- } elseif ($parameter->isArray()) {
|
20 |
-
+ $type = $parameter->getType();
|
21 |
-
+ $typeDeclaration = (PHP_VERSION_ID >= 70100 ? $type->getName() : (string) $type) . ' ';
|
22 |
-
+ } elseif ($isArray) {
|
23 |
-
$typeDeclaration = 'array ';
|
24 |
-
} elseif ((defined('HHVM_VERSION') || version_compare(PHP_VERSION, '5.4.0', '>='))
|
25 |
-
- && $parameter->isCallable()) {
|
26 |
-
+ && $isCallable) {
|
27 |
-
$typeDeclaration = 'callable ';
|
28 |
-
} else {
|
29 |
-
try {
|
30 |
-
- $class = $parameter->getClass();
|
31 |
-
+ if (PHP_VERSION_ID >= 80000) {
|
32 |
-
+ $class = $parameter->getType();
|
33 |
-
+ } else {
|
34 |
-
+ $class = $parameter->getClass();
|
35 |
-
+ }
|
36 |
-
} catch (ReflectionException $e) {
|
37 |
-
throw new PHPUnit_Framework_MockObject_RuntimeException(
|
38 |
-
sprintf(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/tests/phpunit_php7.patch
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php
|
2 |
-
index ba21be3..96931a3 100644
|
3 |
-
--- a/src/Util/Getopt.php
|
4 |
-
+++ b/src/Util/Getopt.php
|
5 |
-
@@ -35,7 +35,15 @@ class PHPUnit_Util_Getopt
|
6 |
-
reset($args);
|
7 |
-
array_map('trim', $args);
|
8 |
-
|
9 |
-
- while (list($i, $arg) = each($args)) {
|
10 |
-
+ while (true) {
|
11 |
-
+ $arg = current($args);
|
12 |
-
+ $i = key($args);
|
13 |
-
+ next($args);
|
14 |
-
+
|
15 |
-
+ if ($arg === false) {
|
16 |
-
+ break;
|
17 |
-
+ }
|
18 |
-
+
|
19 |
-
if ($arg == '') {
|
20 |
-
continue;
|
21 |
-
}
|
22 |
-
@@ -94,11 +102,14 @@ class PHPUnit_Util_Getopt
|
23 |
-
if ($i + 1 < $argLen) {
|
24 |
-
$opts[] = array($opt, substr($arg, $i + 1));
|
25 |
-
break;
|
26 |
-
- } elseif (list(, $opt_arg) = each($args)) {
|
27 |
-
} else {
|
28 |
-
- throw new PHPUnit_Framework_Exception(
|
29 |
-
- "option requires an argument -- $opt"
|
30 |
-
- );
|
31 |
-
+ $opt_arg = current($args);
|
32 |
-
+ next($args);
|
33 |
-
+ if ($opt_arg === false) {
|
34 |
-
+ throw new PHPUnit_Framework_Exception(
|
35 |
-
+ "option requires an argument -- $opt"
|
36 |
-
+ );
|
37 |
-
+ }
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
@@ -139,11 +150,14 @@ class PHPUnit_Util_Getopt
|
42 |
-
|
43 |
-
if (substr($long_opt, -1) == '=') {
|
44 |
-
if (substr($long_opt, -2) != '==') {
|
45 |
-
- if (!strlen($opt_arg) &&
|
46 |
-
- !(list(, $opt_arg) = each($args))) {
|
47 |
-
- throw new PHPUnit_Framework_Exception(
|
48 |
-
- "option --$opt requires an argument"
|
49 |
-
- );
|
50 |
-
+ if (!strlen($opt_arg)) {
|
51 |
-
+ $opt_arg = current($args);
|
52 |
-
+ next($args);
|
53 |
-
+ if ($opt_arg === false) {
|
54 |
-
+ throw new PHPUnit_Framework_Exception(
|
55 |
-
+ "option --$opt requires an argument"
|
56 |
-
+ );
|
57 |
-
+ }
|
58 |
-
}
|
59 |
-
}
|
60 |
-
} elseif ($opt_arg) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/tests/phpunit_php8.patch
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php
|
2 |
-
index 638f42513..b4c7d3a5e 100644
|
3 |
-
--- a/src/Framework/TestCase.php
|
4 |
-
+++ b/src/Framework/TestCase.php
|
5 |
-
@@ -905,7 +905,7 @@ protected function runTest()
|
6 |
-
try {
|
7 |
-
$testResult = $method->invokeArgs(
|
8 |
-
$this,
|
9 |
-
- array_merge($this->data, $this->dependencyInput)
|
10 |
-
+ array_values(array_merge($this->data, $this->dependencyInput))
|
11 |
-
);
|
12 |
-
} catch (Throwable $_e) {
|
13 |
-
$e = $_e;
|
14 |
-
diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
|
15 |
-
index 5c1041608..b2f7a7bd0 100644
|
16 |
-
--- a/src/Util/Configuration.php
|
17 |
-
+++ b/src/Util/Configuration.php
|
18 |
-
@@ -162,7 +162,7 @@ protected function __construct($filename)
|
19 |
-
/**
|
20 |
-
* @since Method available since Release 3.4.0
|
21 |
-
*/
|
22 |
-
- final private function __clone()
|
23 |
-
+ private function __clone()
|
24 |
-
{
|
25 |
-
}
|
26 |
-
|
27 |
-
diff --git a/src/Util/PHP/Template/TestCaseMethod.tpl.dist b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
28 |
-
index b48f354cd..d59cdeea7 100644
|
29 |
-
--- a/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
30 |
-
+++ b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
31 |
-
@@ -78,7 +78,7 @@ if ('' !== $configurationFilePath) {
|
32 |
-
unset($configuration);
|
33 |
-
}
|
34 |
-
|
35 |
-
-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
|
36 |
-
+function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
|
37 |
-
{
|
38 |
-
return true;
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies/predis/predis/tests/phpunit_php81.patch
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
|
2 |
-
index b2f7a7bd0c6..1a1a444d378 100644
|
3 |
-
--- a/src/Util/Configuration.php
|
4 |
-
+++ b/src/Util/Configuration.php
|
5 |
-
@@ -514,22 +514,17 @@ public function handlePHPConfiguration()
|
6 |
-
|
7 |
-
foreach (array('var', 'post', 'get', 'cookie', 'server', 'files', 'request') as $array) {
|
8 |
-
// See https://github.com/sebastianbergmann/phpunit/issues/277
|
9 |
-
- switch ($array) {
|
10 |
-
- case 'var':
|
11 |
-
- $target = &$GLOBALS;
|
12 |
-
- break;
|
13 |
-
-
|
14 |
-
- case 'server':
|
15 |
-
- $target = &$_SERVER;
|
16 |
-
- break;
|
17 |
-
-
|
18 |
-
- default:
|
19 |
-
- $target = &$GLOBALS['_' . strtoupper($array)];
|
20 |
-
- break;
|
21 |
-
- }
|
22 |
-
-
|
23 |
-
foreach ($configuration[$array] as $name => $value) {
|
24 |
-
- $target[$name] = $value;
|
25 |
-
+ switch ($array) {
|
26 |
-
+ case 'var':
|
27 |
-
+ $GLOBALS[$name] = $value;
|
28 |
-
+ break;
|
29 |
-
+ case 'server':
|
30 |
-
+ $_SERVER[$name] = $value;
|
31 |
-
+ break;
|
32 |
-
+ default:
|
33 |
-
+ $GLOBALS['_' . strtoupper($array)][$name] = $value;
|
34 |
-
+ }
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php
|
39 |
-
index 370e97d73f8..5bd8553970b 100644
|
40 |
-
--- a/src/Util/Getopt.php
|
41 |
-
+++ b/src/Util/Getopt.php
|
42 |
-
@@ -144,7 +144,7 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args)
|
43 |
-
|
44 |
-
if (substr($long_opt, -1) == '=') {
|
45 |
-
if (substr($long_opt, -2) != '==') {
|
46 |
-
- if (!strlen($opt_arg)) {
|
47 |
-
+ if (null === $opt_arg || strlen($opt_arg) < 1) {
|
48 |
-
$opt_arg = current($args);
|
49 |
-
next($args);
|
50 |
-
if (!($opt_arg)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-plugin.php
CHANGED
@@ -281,7 +281,7 @@ class Plugin {
|
|
281 |
return;
|
282 |
}
|
283 |
|
284 |
-
wp_enqueue_style( 'redis-cache',
|
285 |
}
|
286 |
|
287 |
/**
|
@@ -593,6 +593,10 @@ class Plugin {
|
|
593 |
* @return void
|
594 |
*/
|
595 |
public function show_admin_notices() {
|
|
|
|
|
|
|
|
|
596 |
if ( ! defined( 'WP_REDIS_DISABLE_BANNERS' ) || ! WP_REDIS_DISABLE_BANNERS ) {
|
597 |
$this->pro_notice();
|
598 |
$this->wc_pro_notice();
|
281 |
return;
|
282 |
}
|
283 |
|
284 |
+
wp_enqueue_style( 'redis-cache', WP_REDIS_PLUGIN_DIR . '/assets/css/admin.css', null, WP_REDIS_VERSION );
|
285 |
}
|
286 |
|
287 |
/**
|
593 |
* @return void
|
594 |
*/
|
595 |
public function show_admin_notices() {
|
596 |
+
if ( defined( '\RedisCachePro\Version' ) || defined( '\ObjectCachePro\Version' ) ) {
|
597 |
+
return;
|
598 |
+
}
|
599 |
+
|
600 |
if ( ! defined( 'WP_REDIS_DISABLE_BANNERS' ) || ! WP_REDIS_DISABLE_BANNERS ) {
|
601 |
$this->pro_notice();
|
602 |
$this->wc_pro_notice();
|
includes/diagnostics.php
CHANGED
@@ -63,7 +63,7 @@ $info['Metrics recorded'] = wp_json_encode( \Rhubarb\RedisCache\Metrics::count()
|
|
63 |
|
64 |
$info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
|
65 |
|
66 |
-
if ( $dropin ) {
|
67 |
$info['Global Prefix'] = wp_json_encode( $wp_object_cache->global_prefix );
|
68 |
$info['Blog Prefix'] = wp_json_encode( $wp_object_cache->blog_prefix );
|
69 |
}
|
@@ -98,7 +98,7 @@ foreach ( $constants as $constant ) {
|
|
98 |
if ( defined( $constant ) ) {
|
99 |
$info[ $constant ] = wp_json_encode(
|
100 |
constant( $constant ),
|
101 |
-
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
102 |
);
|
103 |
}
|
104 |
}
|
@@ -117,19 +117,24 @@ if ( defined( 'WP_REDIS_PASSWORD' ) ) {
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
if ( $dropin ) {
|
121 |
$info['Global Groups'] = wp_json_encode(
|
122 |
-
array_values( $wp_object_cache->global_groups ),
|
123 |
JSON_PRETTY_PRINT
|
124 |
);
|
125 |
|
126 |
$info['Ignored Groups'] = wp_json_encode(
|
127 |
-
array_values( $wp_object_cache->ignored_groups ),
|
128 |
JSON_PRETTY_PRINT
|
129 |
);
|
130 |
|
131 |
$info['Unflushable Groups'] = wp_json_encode(
|
132 |
-
array_values( $wp_object_cache->unflushable_groups ),
|
|
|
|
|
|
|
|
|
|
|
133 |
JSON_PRETTY_PRINT
|
134 |
);
|
135 |
}
|
63 |
|
64 |
$info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
|
65 |
|
66 |
+
if ( $dropin && ! $disabled ) {
|
67 |
$info['Global Prefix'] = wp_json_encode( $wp_object_cache->global_prefix );
|
68 |
$info['Blog Prefix'] = wp_json_encode( $wp_object_cache->blog_prefix );
|
69 |
}
|
98 |
if ( defined( $constant ) ) {
|
99 |
$info[ $constant ] = wp_json_encode(
|
100 |
constant( $constant ),
|
101 |
+
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT
|
102 |
);
|
103 |
}
|
104 |
}
|
117 |
}
|
118 |
}
|
119 |
|
120 |
+
if ( $dropin && ! $disabled ) {
|
121 |
$info['Global Groups'] = wp_json_encode(
|
122 |
+
array_values( $wp_object_cache->global_groups ?? [] ),
|
123 |
JSON_PRETTY_PRINT
|
124 |
);
|
125 |
|
126 |
$info['Ignored Groups'] = wp_json_encode(
|
127 |
+
array_values( $wp_object_cache->ignored_groups ?? [] ),
|
128 |
JSON_PRETTY_PRINT
|
129 |
);
|
130 |
|
131 |
$info['Unflushable Groups'] = wp_json_encode(
|
132 |
+
array_values( $wp_object_cache->unflushable_groups ?? [] ),
|
133 |
+
JSON_PRETTY_PRINT
|
134 |
+
);
|
135 |
+
|
136 |
+
$info['Groups Types'] = wp_json_encode(
|
137 |
+
$wp_object_cache->group_type ?? null,
|
138 |
JSON_PRETTY_PRINT
|
139 |
);
|
140 |
}
|
includes/object-cache.php
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Redis Object Cache Drop-In
|
4 |
-
* Plugin URI:
|
5 |
-
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis,
|
6 |
-
* Version: 2.
|
7 |
* Author: Till Krüss
|
8 |
* Author URI: https://objectcache.pro
|
9 |
* License: GPLv3
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
11 |
*
|
12 |
* @package Rhubarb\RedisCache
|
13 |
*/
|
@@ -460,6 +461,13 @@ class WP_Object_Cache {
|
|
460 |
'themes',
|
461 |
];
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
/**
|
464 |
* Prefix used for global groups.
|
465 |
*
|
@@ -526,6 +534,8 @@ class WP_Object_Cache {
|
|
526 |
$this->unflushable_groups = array_map( [ $this, 'sanitize_key_part' ], WP_REDIS_UNFLUSHABLE_GROUPS );
|
527 |
}
|
528 |
|
|
|
|
|
529 |
if ( defined( 'WP_REDIS_TRACE' ) && WP_REDIS_TRACE ) {
|
530 |
$this->trace_enabled = true;
|
531 |
}
|
@@ -554,7 +564,7 @@ class WP_Object_Cache {
|
|
554 |
}
|
555 |
|
556 |
if ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
557 |
-
$connectionID = current(
|
558 |
|
559 |
$this->diagnostics[ 'ping' ] = ($client === 'predis')
|
560 |
? $this->redis->getClientFor( $connectionID )->ping()
|
@@ -577,6 +587,25 @@ class WP_Object_Cache {
|
|
577 |
}
|
578 |
}
|
579 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
/**
|
581 |
* Determine the Redis client.
|
582 |
*
|
@@ -611,6 +640,7 @@ class WP_Object_Cache {
|
|
611 |
'timeout' => 1,
|
612 |
'read_timeout' => 1,
|
613 |
'retry_interval' => null,
|
|
|
614 |
];
|
615 |
|
616 |
$settings = [
|
@@ -656,18 +686,23 @@ class WP_Object_Cache {
|
|
656 |
|
657 |
$this->diagnostics[ 'shards' ] = WP_REDIS_SHARDS;
|
658 |
} elseif ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
|
665 |
-
|
666 |
-
$args['password'] = $parameters['password'];
|
667 |
}
|
668 |
|
669 |
-
$this->redis = new RedisCluster( null, ...array_values( $args ) );
|
670 |
-
|
671 |
$this->diagnostics += $args;
|
672 |
} else {
|
673 |
$this->redis = new Redis();
|
@@ -690,7 +725,7 @@ class WP_Object_Cache {
|
|
690 |
|
691 |
if ( strcasecmp( 'unix', $parameters['scheme'] ) === 0 ) {
|
692 |
$args['host'] = $parameters['path'];
|
693 |
-
$args['port'] =
|
694 |
}
|
695 |
|
696 |
if ( version_compare( $version, '3.1.3', '>=' ) ) {
|
@@ -834,7 +869,7 @@ class WP_Object_Cache {
|
|
834 |
$parameters['servers'] = $servers;
|
835 |
$options['replication'] = true;
|
836 |
} elseif ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
837 |
-
$servers =
|
838 |
$parameters['cluster'] = $servers;
|
839 |
$options['cluster'] = 'redis';
|
840 |
}
|
@@ -875,6 +910,8 @@ class WP_Object_Cache {
|
|
875 |
* @return void
|
876 |
*/
|
877 |
protected function connect_using_credis( $parameters ) {
|
|
|
|
|
878 |
$client = 'Credis';
|
879 |
|
880 |
$creds_path = sprintf(
|
@@ -940,19 +977,24 @@ class WP_Object_Cache {
|
|
940 |
// phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url
|
941 |
$url_components = parse_url( $connection_string );
|
942 |
|
943 |
-
|
|
|
|
|
944 |
|
945 |
if ( ! $is_cluster && isset( $add_params['alias'] ) ) {
|
946 |
$add_params['master'] = 'master' === $add_params['alias'];
|
947 |
}
|
948 |
|
949 |
$add_params['host'] = $url_components['host'];
|
|
|
950 |
|
951 |
if ( ! isset( $add_params['alias'] ) ) {
|
952 |
$add_params['alias'] = "redis-$index";
|
953 |
}
|
954 |
|
955 |
$clients[ $index ] = array_merge( $parameters, $add_params );
|
|
|
|
|
956 |
}
|
957 |
|
958 |
$this->redis = new Credis_Cluster( $clients );
|
@@ -1007,6 +1049,8 @@ class WP_Object_Cache {
|
|
1007 |
* @return void
|
1008 |
*/
|
1009 |
protected function connect_using_hhvm( $parameters ) {
|
|
|
|
|
1010 |
$this->redis = new Redis();
|
1011 |
|
1012 |
// Adjust host and port if the scheme is `unix`.
|
@@ -1062,7 +1106,11 @@ class WP_Object_Cache {
|
|
1062 |
}
|
1063 |
|
1064 |
if ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
1065 |
-
$
|
|
|
|
|
|
|
|
|
1066 |
} else {
|
1067 |
$info = $this->redis->info();
|
1068 |
}
|
@@ -1132,6 +1180,10 @@ class WP_Object_Cache {
|
|
1132 |
return array_combine( array_keys( $data ), array_fill( 0, count( $data ), false ) );
|
1133 |
}
|
1134 |
|
|
|
|
|
|
|
|
|
1135 |
$values = [];
|
1136 |
|
1137 |
foreach ( $data as $key => $value ) {
|
@@ -1141,6 +1193,99 @@ class WP_Object_Cache {
|
|
1141 |
return $values;
|
1142 |
}
|
1143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1144 |
/**
|
1145 |
* Replace a value in the cache.
|
1146 |
*
|
@@ -1170,19 +1315,21 @@ class WP_Object_Cache {
|
|
1170 |
* @return bool Returns TRUE on success or FALSE on failure.
|
1171 |
*/
|
1172 |
protected function add_or_replace( $add, $key, $value, $group = 'default', $expiration = 0 ) {
|
1173 |
-
$cache_addition_suspended = function_exists( 'wp_suspend_cache_addition' )
|
1174 |
-
? wp_suspend_cache_addition()
|
1175 |
-
: false;
|
1176 |
|
1177 |
if ( $add && $cache_addition_suspended ) {
|
1178 |
return false;
|
1179 |
}
|
1180 |
|
1181 |
$result = true;
|
1182 |
-
|
|
|
|
|
|
|
|
|
1183 |
|
1184 |
// Save if group not excluded and redis is up.
|
1185 |
-
if ( ! $this->is_ignored_group( $
|
1186 |
try {
|
1187 |
$orig_exp = $expiration;
|
1188 |
$expiration = $this->validate_expiration( $expiration );
|
@@ -1275,7 +1422,11 @@ class WP_Object_Cache {
|
|
1275 |
*/
|
1276 |
public function delete( $key, $group = 'default' ) {
|
1277 |
$result = false;
|
1278 |
-
|
|
|
|
|
|
|
|
|
1279 |
|
1280 |
if ( isset( $this->cache[ $derived_key ] ) ) {
|
1281 |
unset( $this->cache[ $derived_key ] );
|
@@ -1284,7 +1435,7 @@ class WP_Object_Cache {
|
|
1284 |
|
1285 |
$start_time = microtime( true );
|
1286 |
|
1287 |
-
if ( $this->redis_status() && ! $this->is_ignored_group( $
|
1288 |
try {
|
1289 |
$result = $this->parse_redis_response( $this->redis->del( $derived_key ) );
|
1290 |
} catch ( Exception $exception ) {
|
@@ -1354,6 +1505,9 @@ class WP_Object_Cache {
|
|
1354 |
* true on success, or false if the contents were not deleted.
|
1355 |
*/
|
1356 |
protected function delete_multiple_at_once( array $keys, $group = 'default' ) {
|
|
|
|
|
|
|
1357 |
if ( $this->is_ignored_group( $group ) ) {
|
1358 |
$results = [];
|
1359 |
|
@@ -1362,9 +1516,20 @@ class WP_Object_Cache {
|
|
1362 |
|
1363 |
$results[ $key ] = isset( $this->cache[ $derived_key ] );
|
1364 |
|
|
|
|
|
|
|
|
|
|
|
1365 |
unset( $this->cache[ $derived_key ] );
|
1366 |
}
|
1367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1368 |
return $results;
|
1369 |
}
|
1370 |
|
@@ -1374,6 +1539,11 @@ class WP_Object_Cache {
|
|
1374 |
foreach ($keys as $key) {
|
1375 |
$derived_key = $this->build_key( (string) $key, $group );
|
1376 |
|
|
|
|
|
|
|
|
|
|
|
1377 |
$tx->del( $derived_key );
|
1378 |
|
1379 |
unset( $this->cache[ $derived_key ] );
|
@@ -1385,6 +1555,12 @@ class WP_Object_Cache {
|
|
1385 |
return (bool) $this->parse_redis_response( $response );
|
1386 |
}, $tx->{$method}() );
|
1387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1388 |
return array_combine( $keys, $results );
|
1389 |
} catch ( Exception $exception ) {
|
1390 |
$this->handle_exception( $exception );
|
@@ -1653,7 +1829,10 @@ LUA;
|
|
1653 |
}
|
1654 |
|
1655 |
$start_time = microtime( true );
|
1656 |
-
|
|
|
|
|
|
|
1657 |
|
1658 |
if ( isset( $this->cache[ $derived_key ] ) && ! $force ) {
|
1659 |
$found = true;
|
@@ -1670,7 +1849,7 @@ LUA;
|
|
1670 |
}
|
1671 |
|
1672 |
return $value;
|
1673 |
-
} elseif ( $this->is_ignored_group( $
|
1674 |
$found = false;
|
1675 |
$this->cache_misses++;
|
1676 |
|
@@ -1789,11 +1968,14 @@ LUA;
|
|
1789 |
$derived_keys = [];
|
1790 |
$start_time = microtime( true );
|
1791 |
|
|
|
|
|
1792 |
foreach ( $keys as $key ) {
|
1793 |
-
$
|
|
|
1794 |
}
|
1795 |
|
1796 |
-
if ( $this->is_ignored_group( $
|
1797 |
$traceKV = [];
|
1798 |
|
1799 |
foreach ( $keys as $key ) {
|
@@ -1971,10 +2153,14 @@ LUA;
|
|
1971 |
public function set( $key, $value, $group = 'default', $expiration = 0 ) {
|
1972 |
$result = true;
|
1973 |
$start_time = microtime( true );
|
1974 |
-
|
|
|
|
|
|
|
|
|
1975 |
|
1976 |
// Save if group not excluded from redis and redis is up.
|
1977 |
-
if ( ! $this->is_ignored_group( $
|
1978 |
$orig_exp = $expiration;
|
1979 |
$expiration = $this->validate_expiration( $expiration );
|
1980 |
|
@@ -2048,11 +2234,107 @@ LUA;
|
|
2048 |
* Default 0 (no expiration).
|
2049 |
* @return bool[] Array of return values, grouped by key. Each value is always true.
|
2050 |
*/
|
2051 |
-
public function set_multiple( array $data, $group = 'default', $
|
|
|
|
|
|
|
|
|
2052 |
$values = [];
|
2053 |
|
2054 |
foreach ( $data as $key => $value ) {
|
2055 |
-
$values[ $key ] = $this->set( $key, $value, $group, $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2056 |
}
|
2057 |
|
2058 |
return $values;
|
@@ -2069,11 +2351,15 @@ LUA;
|
|
2069 |
public function increment( $key, $offset = 1, $group = 'default' ) {
|
2070 |
$offset = (int) $offset;
|
2071 |
$start_time = microtime( true );
|
2072 |
-
|
|
|
|
|
|
|
|
|
2073 |
$trace_flags = self::TRACE_FLAG_READ | self::TRACE_FLAG_WRITE;
|
2074 |
|
2075 |
// If group is a non-Redis group, save to internal cache, not Redis.
|
2076 |
-
if ( $this->is_ignored_group( $
|
2077 |
$value = $this->get_from_internal_cache( $derived_key );
|
2078 |
$value += $offset;
|
2079 |
$this->add_to_internal_cache( $derived_key, $value );
|
@@ -2141,11 +2427,15 @@ LUA;
|
|
2141 |
public function decrement( $key, $offset = 1, $group = 'default' ) {
|
2142 |
$offset = (int) $offset;
|
2143 |
$start_time = microtime( true );
|
2144 |
-
|
|
|
|
|
|
|
|
|
2145 |
$trace_flags = self::TRACE_FLAG_READ | self::TRACE_FLAG_WRITE;
|
2146 |
|
2147 |
// If group is a non-Redis group, save to internal cache, not Redis.
|
2148 |
-
if ( $this->is_ignored_group( $
|
2149 |
$value = $this->get_from_internal_cache( $derived_key );
|
2150 |
$value -= $offset;
|
2151 |
$this->add_to_internal_cache( $derived_key, $value );
|
@@ -2261,7 +2551,7 @@ LUA;
|
|
2261 |
],
|
2262 |
'errors' => empty( $this->errors ) ? null : $this->errors,
|
2263 |
'meta' => [
|
2264 |
-
'Client' => $this->diagnostics['client']
|
2265 |
'Redis Version' => $this->redis_version,
|
2266 |
],
|
2267 |
];
|
@@ -2270,8 +2560,8 @@ LUA;
|
|
2270 |
/**
|
2271 |
* Builds a key for the cached object using the prefix, group and key.
|
2272 |
*
|
2273 |
-
* @param string $key The key under which to store the value.
|
2274 |
-
* @param string $group The group value appended to the $key.
|
2275 |
*
|
2276 |
* @return string
|
2277 |
*/
|
@@ -2280,11 +2570,29 @@ LUA;
|
|
2280 |
$group = 'default';
|
2281 |
}
|
2282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2283 |
$salt = defined( 'WP_REDIS_PREFIX' ) ? trim( WP_REDIS_PREFIX ) : '';
|
|
|
2284 |
$prefix = $this->is_global_group( $group ) ? $this->global_prefix : $this->blog_prefix;
|
2285 |
|
2286 |
-
$key = $this->sanitize_key_part( $key );
|
2287 |
-
$group = $this->sanitize_key_part( $group );
|
2288 |
|
2289 |
$prefix = trim( $prefix, '_-:$' );
|
2290 |
|
@@ -2304,31 +2612,43 @@ LUA;
|
|
2304 |
/**
|
2305 |
* Checks if the given group is part the ignored group array
|
2306 |
*
|
2307 |
-
* @param string $group Name of the group to check.
|
2308 |
* @return bool
|
2309 |
*/
|
2310 |
protected function is_ignored_group( $group ) {
|
2311 |
-
return
|
2312 |
}
|
2313 |
|
2314 |
/**
|
2315 |
* Checks if the given group is part the global group array
|
2316 |
*
|
2317 |
-
* @param string $group Name of the group to check.
|
2318 |
* @return bool
|
2319 |
*/
|
2320 |
protected function is_global_group( $group ) {
|
2321 |
-
return
|
2322 |
}
|
2323 |
|
2324 |
/**
|
2325 |
* Checks if the given group is part the unflushable group array
|
2326 |
*
|
2327 |
-
* @param string $group Name of the group to check.
|
2328 |
* @return bool
|
2329 |
*/
|
2330 |
protected function is_unflushable_group( $group ) {
|
2331 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2332 |
}
|
2333 |
|
2334 |
/**
|
@@ -2415,6 +2735,8 @@ LUA;
|
|
2415 |
} else {
|
2416 |
$this->ignored_groups = array_unique( array_merge( $this->ignored_groups, $groups ) );
|
2417 |
}
|
|
|
|
|
2418 |
}
|
2419 |
|
2420 |
/**
|
@@ -2426,6 +2748,7 @@ LUA;
|
|
2426 |
$groups = (array) $groups;
|
2427 |
|
2428 |
$this->ignored_groups = array_unique( array_merge( $this->ignored_groups, $groups ) );
|
|
|
2429 |
}
|
2430 |
|
2431 |
/**
|
@@ -2437,6 +2760,7 @@ LUA;
|
|
2437 |
$groups = (array) $groups;
|
2438 |
|
2439 |
$this->unflushable_groups = array_unique( array_merge( $this->unflushable_groups, $groups ) );
|
|
|
2440 |
}
|
2441 |
|
2442 |
/**
|
@@ -2663,6 +2987,27 @@ LUA;
|
|
2663 |
}
|
2664 |
}
|
2665 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2666 |
/**
|
2667 |
* Allows access to private properties for backwards compatibility.
|
2668 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Redis Object Cache Drop-In
|
4 |
+
* Plugin URI: https://wordpress.org/plugins/redis-cache/
|
5 |
+
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
|
6 |
+
* Version: 2.1.1
|
7 |
* Author: Till Krüss
|
8 |
* Author URI: https://objectcache.pro
|
9 |
* License: GPLv3
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
* Requires PHP: 7.2
|
12 |
*
|
13 |
* @package Rhubarb\RedisCache
|
14 |
*/
|
461 |
'themes',
|
462 |
];
|
463 |
|
464 |
+
/**
|
465 |
+
* List of groups and their types.
|
466 |
+
*
|
467 |
+
* @var array
|
468 |
+
*/
|
469 |
+
public $group_type = [];
|
470 |
+
|
471 |
/**
|
472 |
* Prefix used for global groups.
|
473 |
*
|
534 |
$this->unflushable_groups = array_map( [ $this, 'sanitize_key_part' ], WP_REDIS_UNFLUSHABLE_GROUPS );
|
535 |
}
|
536 |
|
537 |
+
$this->cache_group_types();
|
538 |
+
|
539 |
if ( defined( 'WP_REDIS_TRACE' ) && WP_REDIS_TRACE ) {
|
540 |
$this->trace_enabled = true;
|
541 |
}
|
564 |
}
|
565 |
|
566 |
if ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
567 |
+
$connectionID = current( $this->build_cluster_connection_array() );
|
568 |
|
569 |
$this->diagnostics[ 'ping' ] = ($client === 'predis')
|
570 |
? $this->redis->getClientFor( $connectionID )->ping()
|
587 |
}
|
588 |
}
|
589 |
|
590 |
+
/**
|
591 |
+
* Set group type array
|
592 |
+
*
|
593 |
+
* @return void
|
594 |
+
*/
|
595 |
+
protected function cache_group_types() {
|
596 |
+
foreach ( $this->global_groups as $group ) {
|
597 |
+
$this->group_type[ $group ] = 'global';
|
598 |
+
}
|
599 |
+
|
600 |
+
foreach ( $this->unflushable_groups as $group ) {
|
601 |
+
$this->group_type[ $group ] = 'unflushable';
|
602 |
+
}
|
603 |
+
|
604 |
+
foreach ( $this->ignored_groups as $group ) {
|
605 |
+
$this->group_type[ $group ] = 'ignored';
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
/**
|
610 |
* Determine the Redis client.
|
611 |
*
|
640 |
'timeout' => 1,
|
641 |
'read_timeout' => 1,
|
642 |
'retry_interval' => null,
|
643 |
+
'persistent' => false,
|
644 |
];
|
645 |
|
646 |
$settings = [
|
686 |
|
687 |
$this->diagnostics[ 'shards' ] = WP_REDIS_SHARDS;
|
688 |
} elseif ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
689 |
+
if ( is_string( WP_REDIS_CLUSTER ) ) {
|
690 |
+
$this->redis = new RedisCluster( WP_REDIS_CLUSTER );
|
691 |
+
} else {
|
692 |
+
$args = [
|
693 |
+
'cluster' => $this->build_cluster_connection_array(),
|
694 |
+
'timeout' => $parameters['timeout'],
|
695 |
+
'read_timeout' => $parameters['read_timeout'],
|
696 |
+
'persistent' => $parameters['persistent'],
|
697 |
+
];
|
698 |
+
|
699 |
+
if ( isset( $parameters['password'] ) && version_compare( $version, '4.3.0', '>=' ) ) {
|
700 |
+
$args['password'] = $parameters['password'];
|
701 |
+
}
|
702 |
|
703 |
+
$this->redis = new RedisCluster( null, ...array_values( $args ) );
|
|
|
704 |
}
|
705 |
|
|
|
|
|
706 |
$this->diagnostics += $args;
|
707 |
} else {
|
708 |
$this->redis = new Redis();
|
725 |
|
726 |
if ( strcasecmp( 'unix', $parameters['scheme'] ) === 0 ) {
|
727 |
$args['host'] = $parameters['path'];
|
728 |
+
$args['port'] = -1;
|
729 |
}
|
730 |
|
731 |
if ( version_compare( $version, '3.1.3', '>=' ) ) {
|
869 |
$parameters['servers'] = $servers;
|
870 |
$options['replication'] = true;
|
871 |
} elseif ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
872 |
+
$servers = $this->build_cluster_connection_array();
|
873 |
$parameters['cluster'] = $servers;
|
874 |
$options['cluster'] = 'redis';
|
875 |
}
|
910 |
* @return void
|
911 |
*/
|
912 |
protected function connect_using_credis( $parameters ) {
|
913 |
+
_doing_it_wrong( __FUNCTION__ , 'Credis support will be removed in future versions.' , '2.0.26' );
|
914 |
+
|
915 |
$client = 'Credis';
|
916 |
|
917 |
$creds_path = sprintf(
|
977 |
// phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url
|
978 |
$url_components = parse_url( $connection_string );
|
979 |
|
980 |
+
if ( isset( $url_components['query'] ) ) {
|
981 |
+
parse_str( $url_components['query'], $add_params );
|
982 |
+
}
|
983 |
|
984 |
if ( ! $is_cluster && isset( $add_params['alias'] ) ) {
|
985 |
$add_params['master'] = 'master' === $add_params['alias'];
|
986 |
}
|
987 |
|
988 |
$add_params['host'] = $url_components['host'];
|
989 |
+
$add_params['port'] = $url_components['port'];
|
990 |
|
991 |
if ( ! isset( $add_params['alias'] ) ) {
|
992 |
$add_params['alias'] = "redis-$index";
|
993 |
}
|
994 |
|
995 |
$clients[ $index ] = array_merge( $parameters, $add_params );
|
996 |
+
|
997 |
+
unset($add_params);
|
998 |
}
|
999 |
|
1000 |
$this->redis = new Credis_Cluster( $clients );
|
1049 |
* @return void
|
1050 |
*/
|
1051 |
protected function connect_using_hhvm( $parameters ) {
|
1052 |
+
_doing_it_wrong( __FUNCTION__ , 'HHVM support will be removed in future versions.' , '2.0.26' );
|
1053 |
+
|
1054 |
$this->redis = new Redis();
|
1055 |
|
1056 |
// Adjust host and port if the scheme is `unix`.
|
1106 |
}
|
1107 |
|
1108 |
if ( defined( 'WP_REDIS_CLUSTER' ) ) {
|
1109 |
+
$connectionID = current( $this->build_cluster_connection_array() );
|
1110 |
+
|
1111 |
+
$info = $this->determine_client() === 'predis'
|
1112 |
+
? $this->redis->getClientFor( $connectionID )->info()
|
1113 |
+
: $this->redis->info( $connectionID );
|
1114 |
} else {
|
1115 |
$info = $this->redis->info();
|
1116 |
}
|
1180 |
return array_combine( array_keys( $data ), array_fill( 0, count( $data ), false ) );
|
1181 |
}
|
1182 |
|
1183 |
+
if ( $this->redis_status() && method_exists( $this->redis, 'pipeline' ) ) {
|
1184 |
+
return $this->add_multiple_at_once( $data, $group, $expire );
|
1185 |
+
}
|
1186 |
+
|
1187 |
$values = [];
|
1188 |
|
1189 |
foreach ( $data as $key => $value ) {
|
1193 |
return $values;
|
1194 |
}
|
1195 |
|
1196 |
+
/**
|
1197 |
+
* Adds multiple values to the cache in one call.
|
1198 |
+
*
|
1199 |
+
* @param array $data Array of keys and values to be added.
|
1200 |
+
* @param string $group Optional. Where the cache contents are grouped.
|
1201 |
+
* @param int $expire Optional. When to expire the cache contents, in seconds.
|
1202 |
+
* Default 0 (no expiration).
|
1203 |
+
* @return bool[] Array of return values, grouped by key. Each value is either
|
1204 |
+
* true on success, or false if cache key and group already exist.
|
1205 |
+
*/
|
1206 |
+
protected function add_multiple_at_once( array $data, $group = 'default', $expire = 0 )
|
1207 |
+
{
|
1208 |
+
$keys = array_keys( $data );
|
1209 |
+
$values = array_combine( $keys, array_fill( 0, count( $keys ), true ) );
|
1210 |
+
$group = $this->sanitize_key_part( $group );
|
1211 |
+
|
1212 |
+
if ( ! $this->is_ignored_group( $group ) ) {
|
1213 |
+
$start_time = microtime( true );
|
1214 |
+
|
1215 |
+
$orig_exp = $expire;
|
1216 |
+
$expire = $this->validate_expiration( $expire );
|
1217 |
+
$tx = $this->redis->pipeline();
|
1218 |
+
$traceKV = [];
|
1219 |
+
|
1220 |
+
foreach ( $data as $key => $value ) {
|
1221 |
+
/** This action is documented in includes/object-cache.php */
|
1222 |
+
$expire = apply_filters( 'redis_cache_expiration', $expire, $key, $group, $orig_exp );
|
1223 |
+
|
1224 |
+
$key = $this->sanitize_key_part( $key );
|
1225 |
+
$derived_key = $this->fast_build_key( $key, $group );
|
1226 |
+
|
1227 |
+
$values[ $key ] = $derived_key || ! isset( $this->cache[ $derived_key ] );
|
1228 |
+
|
1229 |
+
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
1230 |
+
|
1231 |
+
if ( $this->redis instanceof Predis\Client ) {
|
1232 |
+
$args[] = 'nx';
|
1233 |
+
|
1234 |
+
if ( $expire ) {
|
1235 |
+
$args[] = 'ex';
|
1236 |
+
$args[] = $expire;
|
1237 |
+
}
|
1238 |
+
} else {
|
1239 |
+
if ( $expire ) {
|
1240 |
+
$args[] = [ 'nx', 'ex' => $expire ];
|
1241 |
+
} else {
|
1242 |
+
$args[] = [ 'nx' ];
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
$traceKV[ $key ] = [
|
1247 |
+
'value' => $value,
|
1248 |
+
'status' => self::TRACE_FLAG_WRITE,
|
1249 |
+
];
|
1250 |
+
|
1251 |
+
$tx->set( ...$args );
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
try {
|
1255 |
+
$method = ( $this->redis instanceof Predis\Client ) ? 'execute' : 'exec';
|
1256 |
+
|
1257 |
+
$values = array_map( function ( $response ) {
|
1258 |
+
return (bool) $this->parse_redis_response( $response );
|
1259 |
+
}, $tx->{$method}() );
|
1260 |
+
|
1261 |
+
if ( $values ) {
|
1262 |
+
$values = array_combine( $keys, $values );
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
$execute_time = microtime( true ) - $start_time;
|
1266 |
+
|
1267 |
+
if ( $this->trace_enabled ) {
|
1268 |
+
$this->trace_command( 'set', $group, $traceKV, microtime( true ) - $start_time );
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
$this->cache_calls++;
|
1272 |
+
$this->cache_time += $execute_time;
|
1273 |
+
} catch ( Exception $exception ) {
|
1274 |
+
$this->handle_exception( $exception );
|
1275 |
+
|
1276 |
+
return array_combine( $keys, array_fill( 0, count( $keys ), false ) );
|
1277 |
+
}
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
foreach ( $values as $key => $value ) {
|
1281 |
+
if ( $value ) {
|
1282 |
+
$this->add_to_internal_cache( $this->fast_build_key( $key, $group ) , $value );
|
1283 |
+
}
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
return $values;
|
1287 |
+
}
|
1288 |
+
|
1289 |
/**
|
1290 |
* Replace a value in the cache.
|
1291 |
*
|
1315 |
* @return bool Returns TRUE on success or FALSE on failure.
|
1316 |
*/
|
1317 |
protected function add_or_replace( $add, $key, $value, $group = 'default', $expiration = 0 ) {
|
1318 |
+
$cache_addition_suspended = function_exists( 'wp_suspend_cache_addition' ) && wp_suspend_cache_addition();
|
|
|
|
|
1319 |
|
1320 |
if ( $add && $cache_addition_suspended ) {
|
1321 |
return false;
|
1322 |
}
|
1323 |
|
1324 |
$result = true;
|
1325 |
+
|
1326 |
+
$san_key = $this->sanitize_key_part( $key );
|
1327 |
+
$san_group = $this->sanitize_key_part( $group );
|
1328 |
+
|
1329 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
1330 |
|
1331 |
// Save if group not excluded and redis is up.
|
1332 |
+
if ( ! $this->is_ignored_group( $san_group ) && $this->redis_status() ) {
|
1333 |
try {
|
1334 |
$orig_exp = $expiration;
|
1335 |
$expiration = $this->validate_expiration( $expiration );
|
1422 |
*/
|
1423 |
public function delete( $key, $group = 'default' ) {
|
1424 |
$result = false;
|
1425 |
+
|
1426 |
+
$san_key = $this->sanitize_key_part( $key );
|
1427 |
+
$san_group = $this->sanitize_key_part( $group );
|
1428 |
+
|
1429 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
1430 |
|
1431 |
if ( isset( $this->cache[ $derived_key ] ) ) {
|
1432 |
unset( $this->cache[ $derived_key ] );
|
1435 |
|
1436 |
$start_time = microtime( true );
|
1437 |
|
1438 |
+
if ( $this->redis_status() && ! $this->is_ignored_group( $san_group ) ) {
|
1439 |
try {
|
1440 |
$result = $this->parse_redis_response( $this->redis->del( $derived_key ) );
|
1441 |
} catch ( Exception $exception ) {
|
1505 |
* true on success, or false if the contents were not deleted.
|
1506 |
*/
|
1507 |
protected function delete_multiple_at_once( array $keys, $group = 'default' ) {
|
1508 |
+
$start_time = microtime( true );
|
1509 |
+
$traceKV = [];
|
1510 |
+
|
1511 |
if ( $this->is_ignored_group( $group ) ) {
|
1512 |
$results = [];
|
1513 |
|
1516 |
|
1517 |
$results[ $key ] = isset( $this->cache[ $derived_key ] );
|
1518 |
|
1519 |
+
$traceKV[ $key ] = [
|
1520 |
+
'value' => $this->cache[ $derived_key ],
|
1521 |
+
'status' => self::TRACE_FLAG_DEL,
|
1522 |
+
];
|
1523 |
+
|
1524 |
unset( $this->cache[ $derived_key ] );
|
1525 |
}
|
1526 |
|
1527 |
+
$execute_time = microtime( true ) - $start_time;
|
1528 |
+
|
1529 |
+
if ( $this->trace_enabled ) {
|
1530 |
+
$this->trace_command( 'set', $group, $traceKV, $execute_time );
|
1531 |
+
}
|
1532 |
+
|
1533 |
return $results;
|
1534 |
}
|
1535 |
|
1539 |
foreach ($keys as $key) {
|
1540 |
$derived_key = $this->build_key( (string) $key, $group );
|
1541 |
|
1542 |
+
$traceKV[ $key ] = [
|
1543 |
+
'value' => $this->cache[ $derived_key ],
|
1544 |
+
'status' => self::TRACE_FLAG_DEL,
|
1545 |
+
];
|
1546 |
+
|
1547 |
$tx->del( $derived_key );
|
1548 |
|
1549 |
unset( $this->cache[ $derived_key ] );
|
1555 |
return (bool) $this->parse_redis_response( $response );
|
1556 |
}, $tx->{$method}() );
|
1557 |
|
1558 |
+
$execute_time = microtime( true ) - $start_time;
|
1559 |
+
|
1560 |
+
if ( $this->trace_enabled ) {
|
1561 |
+
$this->trace_command( 'set', $group, $traceKV, $execute_time );
|
1562 |
+
}
|
1563 |
+
|
1564 |
return array_combine( $keys, $results );
|
1565 |
} catch ( Exception $exception ) {
|
1566 |
$this->handle_exception( $exception );
|
1829 |
}
|
1830 |
|
1831 |
$start_time = microtime( true );
|
1832 |
+
|
1833 |
+
$san_key = $this->sanitize_key_part( $key );
|
1834 |
+
$san_group = $this->sanitize_key_part( $group );
|
1835 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
1836 |
|
1837 |
if ( isset( $this->cache[ $derived_key ] ) && ! $force ) {
|
1838 |
$found = true;
|
1849 |
}
|
1850 |
|
1851 |
return $value;
|
1852 |
+
} elseif ( $this->is_ignored_group( $san_group ) || ! $this->redis_status() ) {
|
1853 |
$found = false;
|
1854 |
$this->cache_misses++;
|
1855 |
|
1968 |
$derived_keys = [];
|
1969 |
$start_time = microtime( true );
|
1970 |
|
1971 |
+
$san_group = $this->sanitize_key_part( $group );
|
1972 |
+
|
1973 |
foreach ( $keys as $key ) {
|
1974 |
+
$san_key = $this->sanitize_key_part( $key );
|
1975 |
+
$derived_keys[ $key ] = $this->fast_build_key( $san_key, $san_group );
|
1976 |
}
|
1977 |
|
1978 |
+
if ( $this->is_ignored_group( $san_group ) || ! $this->redis_status() ) {
|
1979 |
$traceKV = [];
|
1980 |
|
1981 |
foreach ( $keys as $key ) {
|
2153 |
public function set( $key, $value, $group = 'default', $expiration = 0 ) {
|
2154 |
$result = true;
|
2155 |
$start_time = microtime( true );
|
2156 |
+
|
2157 |
+
$san_key = $this->sanitize_key_part( $key );
|
2158 |
+
$san_group = $this->sanitize_key_part( $group );
|
2159 |
+
|
2160 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
2161 |
|
2162 |
// Save if group not excluded from redis and redis is up.
|
2163 |
+
if ( ! $this->is_ignored_group( $san_group ) && $this->redis_status() ) {
|
2164 |
$orig_exp = $expiration;
|
2165 |
$expiration = $this->validate_expiration( $expiration );
|
2166 |
|
2234 |
* Default 0 (no expiration).
|
2235 |
* @return bool[] Array of return values, grouped by key. Each value is always true.
|
2236 |
*/
|
2237 |
+
public function set_multiple( array $data, $group = 'default', $expire = 0 ) {
|
2238 |
+
if ( $this->redis_status() && method_exists( $this->redis, 'pipeline' ) ) {
|
2239 |
+
return $this->set_multiple_at_once( $data, $group, $expire );
|
2240 |
+
}
|
2241 |
+
|
2242 |
$values = [];
|
2243 |
|
2244 |
foreach ( $data as $key => $value ) {
|
2245 |
+
$values[ $key ] = $this->set( $key, $value, $group, $expire );
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
return $values;
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
/**
|
2252 |
+
* Sets multiple values to the cache in one call.
|
2253 |
+
*
|
2254 |
+
* @param array $data Array of key and value to be set.
|
2255 |
+
* @param string $group Optional. Where the cache contents are grouped.
|
2256 |
+
* @param int $expiration Optional. When to expire the cache contents, in seconds.
|
2257 |
+
* Default 0 (no expiration).
|
2258 |
+
* @return bool[] Array of return values, grouped by key. Each value is always true.
|
2259 |
+
*/
|
2260 |
+
protected function set_multiple_at_once( array $data, $group = 'default', $expiration = 0 )
|
2261 |
+
{
|
2262 |
+
$values = [];
|
2263 |
+
$group = $this->sanitize_key_part( $group );
|
2264 |
+
|
2265 |
+
if ( ! $this->is_ignored_group( $group ) ) {
|
2266 |
+
$start_time = microtime( true );
|
2267 |
+
|
2268 |
+
$orig_exp = $expiration;
|
2269 |
+
$expiration = $this->validate_expiration( $expiration );
|
2270 |
+
$tx = $this->redis->pipeline();
|
2271 |
+
$keys = array_keys( $data );
|
2272 |
+
$traceKV = [];
|
2273 |
+
|
2274 |
+
foreach ( $data as $key => $value ) {
|
2275 |
+
$key = $this->sanitize_key_part( $key );
|
2276 |
+
$derived_key = $this->fast_build_key( $key, $group );
|
2277 |
+
|
2278 |
+
/** This action is documented in includes/object-cache.php */
|
2279 |
+
$expiration = apply_filters( 'redis_cache_expiration', $expiration, $key, $group, $orig_exp );
|
2280 |
+
|
2281 |
+
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
2282 |
+
|
2283 |
+
if ( $this->redis instanceof Predis\Client ) {
|
2284 |
+
$args[] = 'nx';
|
2285 |
+
|
2286 |
+
if ( $expiration ) {
|
2287 |
+
$args[] = 'ex';
|
2288 |
+
$args[] = $expiration;
|
2289 |
+
}
|
2290 |
+
} else {
|
2291 |
+
if ( $expiration ) {
|
2292 |
+
$args[] = [ 'nx', 'ex' => $expiration ];
|
2293 |
+
} else {
|
2294 |
+
$args[] = [ 'nx' ];
|
2295 |
+
}
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
$traceKV[ $key ] = [
|
2299 |
+
'value' => $value,
|
2300 |
+
'status' => self::TRACE_FLAG_WRITE,
|
2301 |
+
];
|
2302 |
+
|
2303 |
+
$tx->set( ...$args );
|
2304 |
+
}
|
2305 |
+
|
2306 |
+
try {
|
2307 |
+
$method = ( $this->redis instanceof Predis\Client ) ? 'execute' : 'exec';
|
2308 |
+
|
2309 |
+
$values = array_map( function ( $response ) {
|
2310 |
+
return (bool) $this->parse_redis_response( $response );
|
2311 |
+
}, $tx->{$method}() );
|
2312 |
+
|
2313 |
+
if ( $values ) {
|
2314 |
+
$values = array_combine( $keys, $values );
|
2315 |
+
}
|
2316 |
+
} catch ( Exception $exception ) {
|
2317 |
+
$this->handle_exception( $exception );
|
2318 |
+
|
2319 |
+
return array_combine( $keys, array_fill( 0, count( $keys ), false ) );
|
2320 |
+
}
|
2321 |
+
|
2322 |
+
$execute_time = microtime( true ) - $start_time;
|
2323 |
+
$this->cache_calls++;
|
2324 |
+
$this->cache_time += $execute_time;
|
2325 |
+
|
2326 |
+
if ( $this->trace_enabled ) {
|
2327 |
+
$this->trace_command( 'set', $group, $traceKV, $execute_time );
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
foreach ($data as $key => $value) {
|
2332 |
+
$key = $this->sanitize_key_part( $key );
|
2333 |
+
$derived_key = $this->fast_build_key( $key, $group );
|
2334 |
+
|
2335 |
+
if ( isset( $values[ $key ] ) && $values[ $key ] ) {
|
2336 |
+
$this->add_to_internal_cache( $derived_key, $value );
|
2337 |
+
}
|
2338 |
}
|
2339 |
|
2340 |
return $values;
|
2351 |
public function increment( $key, $offset = 1, $group = 'default' ) {
|
2352 |
$offset = (int) $offset;
|
2353 |
$start_time = microtime( true );
|
2354 |
+
|
2355 |
+
$san_key = $this->sanitize_key_part( $key );
|
2356 |
+
$san_group = $this->sanitize_key_part( $group );
|
2357 |
+
|
2358 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
2359 |
$trace_flags = self::TRACE_FLAG_READ | self::TRACE_FLAG_WRITE;
|
2360 |
|
2361 |
// If group is a non-Redis group, save to internal cache, not Redis.
|
2362 |
+
if ( $this->is_ignored_group( $san_group ) || ! $this->redis_status() ) {
|
2363 |
$value = $this->get_from_internal_cache( $derived_key );
|
2364 |
$value += $offset;
|
2365 |
$this->add_to_internal_cache( $derived_key, $value );
|
2427 |
public function decrement( $key, $offset = 1, $group = 'default' ) {
|
2428 |
$offset = (int) $offset;
|
2429 |
$start_time = microtime( true );
|
2430 |
+
|
2431 |
+
$san_key = $this->sanitize_key_part( $key );
|
2432 |
+
$san_group = $this->sanitize_key_part( $group );
|
2433 |
+
|
2434 |
+
$derived_key = $this->fast_build_key( $san_key, $san_group );
|
2435 |
$trace_flags = self::TRACE_FLAG_READ | self::TRACE_FLAG_WRITE;
|
2436 |
|
2437 |
// If group is a non-Redis group, save to internal cache, not Redis.
|
2438 |
+
if ( $this->is_ignored_group( $san_group ) || ! $this->redis_status() ) {
|
2439 |
$value = $this->get_from_internal_cache( $derived_key );
|
2440 |
$value -= $offset;
|
2441 |
$this->add_to_internal_cache( $derived_key, $value );
|
2551 |
],
|
2552 |
'errors' => empty( $this->errors ) ? null : $this->errors,
|
2553 |
'meta' => [
|
2554 |
+
'Client' => $this->diagnostics['client'] ?? 'Unknown',
|
2555 |
'Redis Version' => $this->redis_version,
|
2556 |
],
|
2557 |
];
|
2560 |
/**
|
2561 |
* Builds a key for the cached object using the prefix, group and key.
|
2562 |
*
|
2563 |
+
* @param string $key The key under which to store the value, pre-sanitized.
|
2564 |
+
* @param string $group The group value appended to the $key, pre-sanitized.
|
2565 |
*
|
2566 |
* @return string
|
2567 |
*/
|
2570 |
$group = 'default';
|
2571 |
}
|
2572 |
|
2573 |
+
$san_key = $this->sanitize_key_part( $key );
|
2574 |
+
$san_group = $this->sanitize_key_part( $group );
|
2575 |
+
|
2576 |
+
return $this->fast_build_key($san_key, $san_group);
|
2577 |
+
}
|
2578 |
+
|
2579 |
+
/**
|
2580 |
+
* Builds a key for the cached object using the prefix, group and key.
|
2581 |
+
*
|
2582 |
+
* @param string $key The key under which to store the value, pre-sanitized.
|
2583 |
+
* @param string $group The group value appended to the $key, pre-sanitized.
|
2584 |
+
*
|
2585 |
+
* @return string
|
2586 |
+
*/
|
2587 |
+
public function fast_build_key( $key, $group = 'default' ) {
|
2588 |
+
if ( empty( $group ) ) {
|
2589 |
+
$group = 'default';
|
2590 |
+
}
|
2591 |
+
|
2592 |
$salt = defined( 'WP_REDIS_PREFIX' ) ? trim( WP_REDIS_PREFIX ) : '';
|
2593 |
+
|
2594 |
$prefix = $this->is_global_group( $group ) ? $this->global_prefix : $this->blog_prefix;
|
2595 |
|
|
|
|
|
2596 |
|
2597 |
$prefix = trim( $prefix, '_-:$' );
|
2598 |
|
2612 |
/**
|
2613 |
* Checks if the given group is part the ignored group array
|
2614 |
*
|
2615 |
+
* @param string $group Name of the group to check, pre-sanitized.
|
2616 |
* @return bool
|
2617 |
*/
|
2618 |
protected function is_ignored_group( $group ) {
|
2619 |
+
return $this->is_group_of_type( $group, 'ignored' );
|
2620 |
}
|
2621 |
|
2622 |
/**
|
2623 |
* Checks if the given group is part the global group array
|
2624 |
*
|
2625 |
+
* @param string $group Name of the group to check, pre-sanitized.
|
2626 |
* @return bool
|
2627 |
*/
|
2628 |
protected function is_global_group( $group ) {
|
2629 |
+
return $this->is_group_of_type( $group, 'global' );
|
2630 |
}
|
2631 |
|
2632 |
/**
|
2633 |
* Checks if the given group is part the unflushable group array
|
2634 |
*
|
2635 |
+
* @param string $group Name of the group to check, pre-sanitized.
|
2636 |
* @return bool
|
2637 |
*/
|
2638 |
protected function is_unflushable_group( $group ) {
|
2639 |
+
return $this->is_group_of_type( $group, 'unflushable' );
|
2640 |
+
}
|
2641 |
+
|
2642 |
+
/**
|
2643 |
+
* Checks the type of the given group
|
2644 |
+
*
|
2645 |
+
* @param string $group Name of the group to check, pre-sanitized.
|
2646 |
+
* @param string $type Type of the group to check.
|
2647 |
+
* @return bool
|
2648 |
+
*/
|
2649 |
+
private function is_group_of_type( $group, $type ) {
|
2650 |
+
return isset( $this->group_type[ $group ] )
|
2651 |
+
&& $this->group_type[ $group ] == $type;
|
2652 |
}
|
2653 |
|
2654 |
/**
|
2735 |
} else {
|
2736 |
$this->ignored_groups = array_unique( array_merge( $this->ignored_groups, $groups ) );
|
2737 |
}
|
2738 |
+
|
2739 |
+
$this->cache_group_types();
|
2740 |
}
|
2741 |
|
2742 |
/**
|
2748 |
$groups = (array) $groups;
|
2749 |
|
2750 |
$this->ignored_groups = array_unique( array_merge( $this->ignored_groups, $groups ) );
|
2751 |
+
$this->cache_group_types();
|
2752 |
}
|
2753 |
|
2754 |
/**
|
2760 |
$groups = (array) $groups;
|
2761 |
|
2762 |
$this->unflushable_groups = array_unique( array_merge( $this->unflushable_groups, $groups ) );
|
2763 |
+
$this->cache_group_types();
|
2764 |
}
|
2765 |
|
2766 |
/**
|
2987 |
}
|
2988 |
}
|
2989 |
|
2990 |
+
/**
|
2991 |
+
* Builds a clean connection array out of redis clusters array.
|
2992 |
+
*
|
2993 |
+
* @return array
|
2994 |
+
*/
|
2995 |
+
protected function build_cluster_connection_array() {
|
2996 |
+
$cluster = array_values( WP_REDIS_CLUSTER );
|
2997 |
+
|
2998 |
+
foreach ( $cluster as $key => $server ) {
|
2999 |
+
$connection_string = parse_url( $server );
|
3000 |
+
|
3001 |
+
$cluster[ $key ] = sprintf(
|
3002 |
+
"%s:%s",
|
3003 |
+
$connection_string['host'],
|
3004 |
+
$connection_string['port']
|
3005 |
+
);
|
3006 |
+
}
|
3007 |
+
|
3008 |
+
return $cluster;
|
3009 |
+
}
|
3010 |
+
|
3011 |
/**
|
3012 |
* Allows access to private properties for backwards compatibility.
|
3013 |
*
|
includes/ui/settings.php
CHANGED
@@ -98,7 +98,7 @@ defined( '\\ABSPATH' ) || exit;
|
|
98 |
</p>
|
99 |
</div>
|
100 |
|
101 |
-
<?php $is_php7 = version_compare( phpversion(), '7.
|
102 |
<?php $is_phpredis311 = version_compare( phpversion( 'redis' ), '3.1.1', '>=' ); ?>
|
103 |
<?php $phpredis_installed = (bool) phpversion( 'redis' ); ?>
|
104 |
|
@@ -122,7 +122,7 @@ defined( '\\ABSPATH' ) || exit;
|
|
122 |
<?php
|
123 |
printf(
|
124 |
// translators: %s = PHP Version.
|
125 |
-
esc_html__( 'The current version of PHP (%s) is too old. PHP 7.
|
126 |
esc_html( phpversion() )
|
127 |
);
|
128 |
?>
|
98 |
</p>
|
99 |
</div>
|
100 |
|
101 |
+
<?php $is_php7 = version_compare( phpversion(), '7.2', '>=' ); ?>
|
102 |
<?php $is_phpredis311 = version_compare( phpversion( 'redis' ), '3.1.1', '>=' ); ?>
|
103 |
<?php $phpredis_installed = (bool) phpversion( 'redis' ); ?>
|
104 |
|
122 |
<?php
|
123 |
printf(
|
124 |
// translators: %s = PHP Version.
|
125 |
+
esc_html__( 'The current version of PHP (%s) is too old. PHP 7.2 or newer is required.', 'redis-cache' ),
|
126 |
esc_html( phpversion() )
|
127 |
);
|
128 |
?>
|
languages/redis-cache.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the GPLv3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Redis Object Cache 2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/redis-cache\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: redis-cache\n"
|
@@ -26,7 +26,7 @@ msgid "https://wordpress.org/plugins/redis-cache/"
|
|
26 |
msgstr ""
|
27 |
|
28 |
#. Description of the plugin
|
29 |
-
msgid "A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay,
|
30 |
msgstr ""
|
31 |
|
32 |
#. Author of the plugin
|
@@ -358,7 +358,7 @@ msgstr ""
|
|
358 |
|
359 |
#. translators: %s = PHP Version.
|
360 |
#: includes/ui/settings.php:125
|
361 |
-
msgid "The current version of PHP (%s) is too old. PHP 7.
|
362 |
msgstr ""
|
363 |
|
364 |
#: includes/ui/settings.php:134
|
2 |
# This file is distributed under the GPLv3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Redis Object Cache 2.1.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/redis-cache\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-07-18T16:28:07+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: redis-cache\n"
|
26 |
msgstr ""
|
27 |
|
28 |
#. Description of the plugin
|
29 |
+
msgid "A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI."
|
30 |
msgstr ""
|
31 |
|
32 |
#. Author of the plugin
|
358 |
|
359 |
#. translators: %s = PHP Version.
|
360 |
#: includes/ui/settings.php:125
|
361 |
+
msgid "The current version of PHP (%s) is too old. PHP 7.2 or newer is required."
|
362 |
msgstr ""
|
363 |
|
364 |
#: includes/ui/settings.php:134
|
readme.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
=== Redis Object Cache ===
|
2 |
Contributors: tillkruess
|
3 |
Donate link: https://github.com/sponsors/tillkruss
|
4 |
-
Tags: redis, predis, phpredis, credis,
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.0
|
7 |
-
Requires PHP:
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
-
A persistent object cache backend powered by Redis. Supports Predis, PhpRedis,
|
13 |
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
-
A persistent object cache backend powered by Redis. Supports [Predis](https://github.com/predis/predis/), [PhpRedis (PECL)](https://github.com/phpredis/phpredis), [Relay](https://relaycache.com),
|
18 |
|
19 |
To adjust the connection parameters, prefix cache keys or configure replication/clustering, please see [our wiki](https://github.com/rhubarbgroup/redis-cache/wiki).
|
20 |
|
@@ -63,7 +63,7 @@ Please see the [configuration options wiki page](https://github.com/rhubarbgroup
|
|
63 |
|
64 |
== Replication & Clustering ==
|
65 |
|
66 |
-
To use Replication, Sharding or Clustering, make sure your server is running PHP7 or higher
|
67 |
|
68 |
Please see the [replication & clustering wiki page](https://github.com/rhubarbgroup/redis-cache/wiki/Replication-&-Clustering) for more information.
|
69 |
|
@@ -83,6 +83,25 @@ To see a list of all available WP-CLI commands, please see the [WP CLI commands
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
= 2.0.26 =
|
87 |
|
88 |
- Fixed a bug in `wp_cache_delete_multiple()` when using Predis
|
@@ -553,6 +572,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
|
|
553 |
|
554 |
== Upgrade Notice ==
|
555 |
|
556 |
-
= 2.
|
557 |
|
558 |
-
|
1 |
=== Redis Object Cache ===
|
2 |
Contributors: tillkruess
|
3 |
Donate link: https://github.com/sponsors/tillkruss
|
4 |
+
Tags: redis, predis, phpredis, credis, relay, caching, cache, object cache, performance, replication, clustering, keydb
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.0
|
7 |
+
Requires PHP: 7.2
|
8 |
+
Stable tag: 2.1.1
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
+
A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
|
13 |
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
+
A persistent object cache backend powered by Redis. Supports [Predis](https://github.com/predis/predis/), [PhpRedis (PECL)](https://github.com/phpredis/phpredis), [Relay](https://relaycache.com), replication, sentinels, clustering and [WP-CLI](http://wp-cli.org/).
|
18 |
|
19 |
To adjust the connection parameters, prefix cache keys or configure replication/clustering, please see [our wiki](https://github.com/rhubarbgroup/redis-cache/wiki).
|
20 |
|
63 |
|
64 |
== Replication & Clustering ==
|
65 |
|
66 |
+
To use Replication, Sharding or Clustering, make sure your server is running PHP7 or higher and you consulted the [Predis](https://github.com/predis/predis) or [PhpRedis](https://github.com/phpredis/phpredis) documentation.
|
67 |
|
68 |
Please see the [replication & clustering wiki page](https://github.com/rhubarbgroup/redis-cache/wiki/Replication-&-Clustering) for more information.
|
69 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 2.1.1 =
|
87 |
+
|
88 |
+
- Bumped PHP requirement to 7.2
|
89 |
+
- Renamed `WP_REDIS_DIR` to `WP_REDIS_PLUGIN_DIR`
|
90 |
+
- Fixed rare fatal error in diagnostics
|
91 |
+
- Allow Predis v1.1 Composer installs
|
92 |
+
- Support using `WP_REDIS_CLUSTER` string
|
93 |
+
|
94 |
+
= 2.1.0 =
|
95 |
+
|
96 |
+
- Bumped PHP requirement to 7.0
|
97 |
+
- Deprecated Credis and HHVM clients
|
98 |
+
- Updated Predis to v2.0.0
|
99 |
+
- Updated Credis to v1.13.1
|
100 |
+
- Improved cluster readability in diagnostics
|
101 |
+
- Improved connecting to clusters
|
102 |
+
- Fixed pinging clusters after connecting
|
103 |
+
- Fixed several bugs in `connect_using_credis()`
|
104 |
+
|
105 |
= 2.0.26 =
|
106 |
|
107 |
- Fixed a bug in `wp_cache_delete_multiple()` when using Predis
|
572 |
|
573 |
== Upgrade Notice ==
|
574 |
|
575 |
+
= 2.1.1 =
|
576 |
|
577 |
+
Bumped PHP requirement to 7.2, updated Predis to v2.0 and deprecated Credis and HHVM clients.
|
redis-cache.php
CHANGED
@@ -2,12 +2,12 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Redis Object Cache
|
4 |
* Plugin URI: https://wordpress.org/plugins/redis-cache/
|
5 |
-
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay,
|
6 |
-
* Version: 2.
|
7 |
* Text Domain: redis-cache
|
8 |
* Domain Path: /languages
|
9 |
* Network: true
|
10 |
-
* Requires PHP:
|
11 |
* Author: Till Krüss
|
12 |
* Author URI: https://objectcache.pro
|
13 |
* GitHub Plugin URI: https://github.com/rhubarbgroup/redis-cache
|
@@ -22,7 +22,7 @@ defined( 'ABSPATH' ) || exit;
|
|
22 |
define( 'WP_REDIS_FILE', __FILE__ );
|
23 |
define( 'WP_REDIS_PLUGIN_PATH', __DIR__ );
|
24 |
define( 'WP_REDIS_BASENAME', plugin_basename( WP_REDIS_FILE ) );
|
25 |
-
define( '
|
26 |
|
27 |
$meta = get_file_data( WP_REDIS_FILE, [ 'Version' => 'Version' ] );
|
28 |
|
2 |
/**
|
3 |
* Plugin Name: Redis Object Cache
|
4 |
* Plugin URI: https://wordpress.org/plugins/redis-cache/
|
5 |
+
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
|
6 |
+
* Version: 2.1.1
|
7 |
* Text Domain: redis-cache
|
8 |
* Domain Path: /languages
|
9 |
* Network: true
|
10 |
+
* Requires PHP: 7.2
|
11 |
* Author: Till Krüss
|
12 |
* Author URI: https://objectcache.pro
|
13 |
* GitHub Plugin URI: https://github.com/rhubarbgroup/redis-cache
|
22 |
define( 'WP_REDIS_FILE', __FILE__ );
|
23 |
define( 'WP_REDIS_PLUGIN_PATH', __DIR__ );
|
24 |
define( 'WP_REDIS_BASENAME', plugin_basename( WP_REDIS_FILE ) );
|
25 |
+
define( 'WP_REDIS_PLUGIN_DIR', plugin_dir_url( WP_REDIS_FILE ) );
|
26 |
|
27 |
$meta = get_file_data( WP_REDIS_FILE, [ 'Version' => 'Version' ] );
|
28 |
|