From b2575bd6671588dc1b6b53a69062aef96bd9a518 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Mon, 25 Apr 2011 12:39:21 +0200 Subject: [PATCH] Reorganize some Redis commands classes. --- .../Commands/{Auth.php => ConnectionAuth.php} | 2 +- .../{DoEcho.php => ConnectionEcho.php} | 2 +- .../Commands/{Ping.php => ConnectionPing.php} | 2 +- .../Commands/{Quit.php => ConnectionQuit.php} | 2 +- ...electDatabase.php => ConnectionSelect.php} | 2 +- .../Commands/{Delete.php => KeyDelete.php} | 2 +- .../Commands/{Exists.php => KeyExists.php} | 2 +- .../Commands/{Expire.php => KeyExpire.php} | 2 +- .../{ExpireAt.php => KeyExpireAt.php} | 2 +- lib/Predis/Commands/{Keys.php => KeyKeys.php} | 2 +- .../{KeysV12x.php => KeyKeysV12x.php} | 2 +- .../Commands/{MoveKey.php => KeyMove.php} | 2 +- .../Commands/{Persist.php => KeyPersist.php} | 2 +- .../Commands/{RandomKey.php => KeyRandom.php} | 2 +- .../Commands/{Rename.php => KeyRename.php} | 2 +- ...namePreserve.php => KeyRenamePreserve.php} | 2 +- lib/Predis/Commands/{Sort.php => KeySort.php} | 2 +- .../{TimeToLive.php => KeyTimeToLive.php} | 2 +- lib/Predis/Commands/{Type.php => KeyType.php} | 2 +- .../{Publish.php => PubSubPublish.php} | 2 +- .../{Subscribe.php => PubSubSubscribe.php} | 2 +- ...ttern.php => PubSubSubscribeByPattern.php} | 2 +- ...{Unsubscribe.php => PubSubUnsubscribe.php} | 2 +- ...ern.php => PubSubUnsubscribeByPattern.php} | 2 +- ...ile.php => ServerBackgroundRewriteAOF.php} | 2 +- ...roundSave.php => ServerBackgroundSave.php} | 2 +- .../Commands/{Client.php => ServerClient.php} | 2 +- .../Commands/{Config.php => ServerConfig.php} | 2 +- ...atabaseSize.php => ServerDatabaseSize.php} | 2 +- .../{FlushAll.php => ServerFlushAll.php} | 2 +- ...shDatabase.php => ServerFlushDatabase.php} | 2 +- .../Commands/{Info.php => ServerInfo.php} | 2 +- .../{InfoV24x.php => ServerInfoV24x.php} | 2 +- .../{LastSave.php => ServerLastSave.php} | 2 +- lib/Predis/Commands/ServerMonitor.php | 13 ++ .../{DebugObject.php => ServerObject.php} | 2 +- .../Commands/{Save.php => ServerSave.php} | 2 +- .../{Shutdown.php => ServerShutdown.php} | 2 +- .../{SlaveOf.php => ServerSlaveOf.php} | 2 +- .../Commands/{Append.php => StringAppend.php} | 2 +- .../{Decrement.php => StringDecrement.php} | 2 +- ...{DecrementBy.php => StringDecrementBy.php} | 2 +- .../Commands/{Get.php => StringGet.php} | 2 +- .../Commands/{GetBit.php => StringGetBit.php} | 2 +- ...{GetMultiple.php => StringGetMultiple.php} | 2 +- .../{GetRange.php => StringGetRange.php} | 2 +- .../Commands/{GetSet.php => StringGetSet.php} | 2 +- .../{Increment.php => StringIncrement.php} | 2 +- ...{IncrementBy.php => StringIncrementBy.php} | 2 +- .../Commands/{Set.php => StringSet.php} | 2 +- .../Commands/{SetBit.php => StringSetBit.php} | 2 +- .../{SetExpire.php => StringSetExpire.php} | 2 +- ...{SetMultiple.php => StringSetMultiple.php} | 2 +- ...erve.php => StringSetMultiplePreserve.php} | 2 +- ...{SetPreserve.php => StringSetPreserve.php} | 2 +- .../{SetRange.php => StringSetRange.php} | 2 +- .../Commands/{Strlen.php => StringStrlen.php} | 2 +- .../Commands/{Substr.php => StringSubstr.php} | 2 +- .../{Discard.php => TransactionDiscard.php} | 2 +- .../{Exec.php => TransactionExec.php} | 2 +- .../{Multi.php => TransactionMulti.php} | 2 +- .../{Unwatch.php => TransactionUnwatch.php} | 2 +- .../{Watch.php => TransactionWatch.php} | 2 +- lib/Predis/Profiles/ServerVersion12.php | 90 +++++------ lib/Predis/Profiles/ServerVersion20.php | 118 +++++++-------- lib/Predis/Profiles/ServerVersion22.php | 142 +++++++++--------- lib/Predis/Profiles/ServerVersionNext.php | 4 +- test/ClientFeaturesTest.php | 16 +- 68 files changed, 248 insertions(+), 259 deletions(-) rename lib/Predis/Commands/{Auth.php => ConnectionAuth.php} (80%) rename lib/Predis/Commands/{DoEcho.php => ConnectionEcho.php} (80%) rename lib/Predis/Commands/{Ping.php => ConnectionPing.php} (87%) rename lib/Predis/Commands/{Quit.php => ConnectionQuit.php} (80%) rename lib/Predis/Commands/{SelectDatabase.php => ConnectionSelect.php} (80%) rename lib/Predis/Commands/{Delete.php => KeyDelete.php} (92%) rename lib/Predis/Commands/{Exists.php => KeyExists.php} (83%) rename lib/Predis/Commands/{Expire.php => KeyExpire.php} (83%) rename lib/Predis/Commands/{ExpireAt.php => KeyExpireAt.php} (83%) rename lib/Predis/Commands/{Keys.php => KeyKeys.php} (83%) rename lib/Predis/Commands/{KeysV12x.php => KeyKeysV12x.php} (77%) rename lib/Predis/Commands/{MoveKey.php => KeyMove.php} (88%) rename lib/Predis/Commands/{Persist.php => KeyPersist.php} (83%) rename lib/Predis/Commands/{RandomKey.php => KeyRandom.php} (88%) rename lib/Predis/Commands/{Rename.php => KeyRename.php} (83%) rename lib/Predis/Commands/{RenamePreserve.php => KeyRenamePreserve.php} (85%) rename lib/Predis/Commands/{Sort.php => KeySort.php} (97%) rename lib/Predis/Commands/{TimeToLive.php => KeyTimeToLive.php} (71%) rename lib/Predis/Commands/{Type.php => KeyType.php} (75%) rename lib/Predis/Commands/{Publish.php => PubSubPublish.php} (81%) rename lib/Predis/Commands/{Subscribe.php => PubSubSubscribe.php} (88%) rename lib/Predis/Commands/{SubscribeByPattern.php => PubSubSubscribeByPattern.php} (86%) rename lib/Predis/Commands/{Unsubscribe.php => PubSubUnsubscribe.php} (80%) rename lib/Predis/Commands/{UnsubscribeByPattern.php => PubSubUnsubscribeByPattern.php} (77%) rename lib/Predis/Commands/{BackgroundRewriteAppendOnlyFile.php => ServerBackgroundRewriteAOF.php} (84%) rename lib/Predis/Commands/{BackgroundSave.php => ServerBackgroundSave.php} (87%) rename lib/Predis/Commands/{Client.php => ServerClient.php} (96%) rename lib/Predis/Commands/{Config.php => ServerConfig.php} (81%) rename lib/Predis/Commands/{DatabaseSize.php => ServerDatabaseSize.php} (79%) rename lib/Predis/Commands/{FlushAll.php => ServerFlushAll.php} (81%) rename lib/Predis/Commands/{FlushDatabase.php => ServerFlushDatabase.php} (79%) rename lib/Predis/Commands/{Info.php => ServerInfo.php} (97%) rename lib/Predis/Commands/{InfoV24x.php => ServerInfoV24x.php} (95%) rename lib/Predis/Commands/{LastSave.php => ServerLastSave.php} (81%) create mode 100644 lib/Predis/Commands/ServerMonitor.php rename lib/Predis/Commands/{DebugObject.php => ServerObject.php} (83%) rename lib/Predis/Commands/{Save.php => ServerSave.php} (82%) rename lib/Predis/Commands/{Shutdown.php => ServerShutdown.php} (81%) rename lib/Predis/Commands/{SlaveOf.php => ServerSlaveOf.php} (90%) rename lib/Predis/Commands/{Append.php => StringAppend.php} (72%) rename lib/Predis/Commands/{Decrement.php => StringDecrement.php} (70%) rename lib/Predis/Commands/{DecrementBy.php => StringDecrementBy.php} (70%) rename lib/Predis/Commands/{Get.php => StringGet.php} (73%) rename lib/Predis/Commands/{GetBit.php => StringGetBit.php} (72%) rename lib/Predis/Commands/{GetMultiple.php => StringGetMultiple.php} (89%) rename lib/Predis/Commands/{GetRange.php => StringGetRange.php} (71%) rename lib/Predis/Commands/{GetSet.php => StringGetSet.php} (72%) rename lib/Predis/Commands/{Increment.php => StringIncrement.php} (70%) rename lib/Predis/Commands/{IncrementBy.php => StringIncrementBy.php} (70%) rename lib/Predis/Commands/{Set.php => StringSet.php} (73%) rename lib/Predis/Commands/{SetBit.php => StringSetBit.php} (72%) rename lib/Predis/Commands/{SetExpire.php => StringSetExpire.php} (70%) rename lib/Predis/Commands/{SetMultiple.php => StringSetMultiple.php} (94%) rename lib/Predis/Commands/{SetMultiplePreserve.php => StringSetMultiplePreserve.php} (74%) rename lib/Predis/Commands/{SetPreserve.php => StringSetPreserve.php} (80%) rename lib/Predis/Commands/{SetRange.php => StringSetRange.php} (71%) rename lib/Predis/Commands/{Strlen.php => StringStrlen.php} (72%) rename lib/Predis/Commands/{Substr.php => StringSubstr.php} (72%) rename lib/Predis/Commands/{Discard.php => TransactionDiscard.php} (79%) rename lib/Predis/Commands/{Exec.php => TransactionExec.php} (80%) rename lib/Predis/Commands/{Multi.php => TransactionMulti.php} (80%) rename lib/Predis/Commands/{Unwatch.php => TransactionUnwatch.php} (85%) rename lib/Predis/Commands/{Watch.php => TransactionWatch.php} (91%) diff --git a/lib/Predis/Commands/Auth.php b/lib/Predis/Commands/ConnectionAuth.php similarity index 80% rename from lib/Predis/Commands/Auth.php rename to lib/Predis/Commands/ConnectionAuth.php index ad9ea3f6..181a2be5 100644 --- a/lib/Predis/Commands/Auth.php +++ b/lib/Predis/Commands/ConnectionAuth.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Auth extends Command { +class ConnectionAuth extends Command { public function getId() { return 'AUTH'; } diff --git a/lib/Predis/Commands/DoEcho.php b/lib/Predis/Commands/ConnectionEcho.php similarity index 80% rename from lib/Predis/Commands/DoEcho.php rename to lib/Predis/Commands/ConnectionEcho.php index aeeef8a4..fca78bd6 100644 --- a/lib/Predis/Commands/DoEcho.php +++ b/lib/Predis/Commands/ConnectionEcho.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class DoEcho extends Command { +class ConnectionEcho extends Command { public function getId() { return 'ECHO'; } diff --git a/lib/Predis/Commands/Ping.php b/lib/Predis/Commands/ConnectionPing.php similarity index 87% rename from lib/Predis/Commands/Ping.php rename to lib/Predis/Commands/ConnectionPing.php index f5025307..2ccb12db 100644 --- a/lib/Predis/Commands/Ping.php +++ b/lib/Predis/Commands/ConnectionPing.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Ping extends Command { +class ConnectionPing extends Command { public function getId() { return 'PING'; } diff --git a/lib/Predis/Commands/Quit.php b/lib/Predis/Commands/ConnectionQuit.php similarity index 80% rename from lib/Predis/Commands/Quit.php rename to lib/Predis/Commands/ConnectionQuit.php index 1f80a862..b7d58f74 100644 --- a/lib/Predis/Commands/Quit.php +++ b/lib/Predis/Commands/ConnectionQuit.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Quit extends Command { +class ConnectionQuit extends Command { public function getId() { return 'QUIT'; } diff --git a/lib/Predis/Commands/SelectDatabase.php b/lib/Predis/Commands/ConnectionSelect.php similarity index 80% rename from lib/Predis/Commands/SelectDatabase.php rename to lib/Predis/Commands/ConnectionSelect.php index d831ddd4..254cb3c8 100644 --- a/lib/Predis/Commands/SelectDatabase.php +++ b/lib/Predis/Commands/ConnectionSelect.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class SelectDatabase extends Command { +class ConnectionSelect extends Command { public function getId() { return 'SELECT'; } diff --git a/lib/Predis/Commands/Delete.php b/lib/Predis/Commands/KeyDelete.php similarity index 92% rename from lib/Predis/Commands/Delete.php rename to lib/Predis/Commands/KeyDelete.php index 02ee48c1..f5b28fa1 100644 --- a/lib/Predis/Commands/Delete.php +++ b/lib/Predis/Commands/KeyDelete.php @@ -4,7 +4,7 @@ namespace Predis\Commands; use Predis\Helpers; -class Delete extends Command { +class KeyDelete extends Command { public function getId() { return 'DEL'; } diff --git a/lib/Predis/Commands/Exists.php b/lib/Predis/Commands/KeyExists.php similarity index 83% rename from lib/Predis/Commands/Exists.php rename to lib/Predis/Commands/KeyExists.php index 43bba57e..9845e641 100644 --- a/lib/Predis/Commands/Exists.php +++ b/lib/Predis/Commands/KeyExists.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Exists extends Command { +class KeyExists extends Command { public function getId() { return 'EXISTS'; } diff --git a/lib/Predis/Commands/Expire.php b/lib/Predis/Commands/KeyExpire.php similarity index 83% rename from lib/Predis/Commands/Expire.php rename to lib/Predis/Commands/KeyExpire.php index ec0cc674..a7a1fe2e 100644 --- a/lib/Predis/Commands/Expire.php +++ b/lib/Predis/Commands/KeyExpire.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Expire extends Command { +class KeyExpire extends Command { public function getId() { return 'EXPIRE'; } diff --git a/lib/Predis/Commands/ExpireAt.php b/lib/Predis/Commands/KeyExpireAt.php similarity index 83% rename from lib/Predis/Commands/ExpireAt.php rename to lib/Predis/Commands/KeyExpireAt.php index 3c7984b2..b6cec939 100644 --- a/lib/Predis/Commands/ExpireAt.php +++ b/lib/Predis/Commands/KeyExpireAt.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class ExpireAt extends Command { +class KeyExpireAt extends Command { public function getId() { return 'EXPIREAT'; } diff --git a/lib/Predis/Commands/Keys.php b/lib/Predis/Commands/KeyKeys.php similarity index 83% rename from lib/Predis/Commands/Keys.php rename to lib/Predis/Commands/KeyKeys.php index 2510f903..28e29b33 100644 --- a/lib/Predis/Commands/Keys.php +++ b/lib/Predis/Commands/KeyKeys.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Keys extends Command { +class KeyKeys extends Command { public function getId() { return 'KEYS'; } diff --git a/lib/Predis/Commands/KeysV12x.php b/lib/Predis/Commands/KeyKeysV12x.php similarity index 77% rename from lib/Predis/Commands/KeysV12x.php rename to lib/Predis/Commands/KeyKeysV12x.php index a4483891..a9fa8b67 100644 --- a/lib/Predis/Commands/KeysV12x.php +++ b/lib/Predis/Commands/KeyKeysV12x.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class KeysV12x extends Keys { +class KeyKeysV12x extends KeyKeys { public function parseResponse($data) { return explode(' ', $data); } diff --git a/lib/Predis/Commands/MoveKey.php b/lib/Predis/Commands/KeyMove.php similarity index 88% rename from lib/Predis/Commands/MoveKey.php rename to lib/Predis/Commands/KeyMove.php index 67089dde..38ac9536 100644 --- a/lib/Predis/Commands/MoveKey.php +++ b/lib/Predis/Commands/KeyMove.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class MoveKey extends Command { +class KeyMove extends Command { public function getId() { return 'MOVE'; } diff --git a/lib/Predis/Commands/Persist.php b/lib/Predis/Commands/KeyPersist.php similarity index 83% rename from lib/Predis/Commands/Persist.php rename to lib/Predis/Commands/KeyPersist.php index 8a56d431..24eb21d5 100644 --- a/lib/Predis/Commands/Persist.php +++ b/lib/Predis/Commands/KeyPersist.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Persist extends Command { +class KeyPersist extends Command { public function getId() { return 'PERSIST'; } diff --git a/lib/Predis/Commands/RandomKey.php b/lib/Predis/Commands/KeyRandom.php similarity index 88% rename from lib/Predis/Commands/RandomKey.php rename to lib/Predis/Commands/KeyRandom.php index 0eea5e0b..4b2afdfb 100644 --- a/lib/Predis/Commands/RandomKey.php +++ b/lib/Predis/Commands/KeyRandom.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class RandomKey extends Command { +class KeyRandom extends Command { public function getId() { return 'RANDOMKEY'; } diff --git a/lib/Predis/Commands/Rename.php b/lib/Predis/Commands/KeyRename.php similarity index 83% rename from lib/Predis/Commands/Rename.php rename to lib/Predis/Commands/KeyRename.php index b7ff7e46..c866972d 100644 --- a/lib/Predis/Commands/Rename.php +++ b/lib/Predis/Commands/KeyRename.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Rename extends Command { +class KeyRename extends Command { public function getId() { return 'RENAME'; } diff --git a/lib/Predis/Commands/RenamePreserve.php b/lib/Predis/Commands/KeyRenamePreserve.php similarity index 85% rename from lib/Predis/Commands/RenamePreserve.php rename to lib/Predis/Commands/KeyRenamePreserve.php index 725421b9..4421c13a 100644 --- a/lib/Predis/Commands/RenamePreserve.php +++ b/lib/Predis/Commands/KeyRenamePreserve.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class RenamePreserve extends Command { +class KeyRenamePreserve extends Command { public function getId() { return 'RENAMENX'; } diff --git a/lib/Predis/Commands/Sort.php b/lib/Predis/Commands/KeySort.php similarity index 97% rename from lib/Predis/Commands/Sort.php rename to lib/Predis/Commands/KeySort.php index e127ac8a..bef3430d 100644 --- a/lib/Predis/Commands/Sort.php +++ b/lib/Predis/Commands/KeySort.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Sort extends Command { +class KeySort extends Command { public function getId() { return 'SORT'; } diff --git a/lib/Predis/Commands/TimeToLive.php b/lib/Predis/Commands/KeyTimeToLive.php similarity index 71% rename from lib/Predis/Commands/TimeToLive.php rename to lib/Predis/Commands/KeyTimeToLive.php index 4ca394e8..5f0c347d 100644 --- a/lib/Predis/Commands/TimeToLive.php +++ b/lib/Predis/Commands/KeyTimeToLive.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class TimeToLive extends Command { +class KeyTimeToLive extends Command { public function getId() { return 'TTL'; } diff --git a/lib/Predis/Commands/Type.php b/lib/Predis/Commands/KeyType.php similarity index 75% rename from lib/Predis/Commands/Type.php rename to lib/Predis/Commands/KeyType.php index 425d1928..d7f8fe1e 100644 --- a/lib/Predis/Commands/Type.php +++ b/lib/Predis/Commands/KeyType.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Type extends Command { +class KeyType extends Command { public function getId() { return 'TYPE'; } diff --git a/lib/Predis/Commands/Publish.php b/lib/Predis/Commands/PubSubPublish.php similarity index 81% rename from lib/Predis/Commands/Publish.php rename to lib/Predis/Commands/PubSubPublish.php index b29025c6..c28b4c7e 100644 --- a/lib/Predis/Commands/Publish.php +++ b/lib/Predis/Commands/PubSubPublish.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Publish extends Command { +class PubSubPublish extends Command { public function getId() { return 'PUBLISH'; } diff --git a/lib/Predis/Commands/Subscribe.php b/lib/Predis/Commands/PubSubSubscribe.php similarity index 88% rename from lib/Predis/Commands/Subscribe.php rename to lib/Predis/Commands/PubSubSubscribe.php index e900bd91..e621cde8 100644 --- a/lib/Predis/Commands/Subscribe.php +++ b/lib/Predis/Commands/PubSubSubscribe.php @@ -4,7 +4,7 @@ namespace Predis\Commands; use Predis\Helpers; -class Subscribe extends Command { +class PubSubSubscribe extends Command { public function getId() { return 'SUBSCRIBE'; } diff --git a/lib/Predis/Commands/SubscribeByPattern.php b/lib/Predis/Commands/PubSubSubscribeByPattern.php similarity index 86% rename from lib/Predis/Commands/SubscribeByPattern.php rename to lib/Predis/Commands/PubSubSubscribeByPattern.php index 2094eecc..ea733226 100644 --- a/lib/Predis/Commands/SubscribeByPattern.php +++ b/lib/Predis/Commands/PubSubSubscribeByPattern.php @@ -4,7 +4,7 @@ namespace Predis\Commands; use Predis\Helpers; -class SubscribeByPattern extends Command { +class PubSubSubscribeByPattern extends Command { public function getId() { return 'PSUBSCRIBE'; } diff --git a/lib/Predis/Commands/Unsubscribe.php b/lib/Predis/Commands/PubSubUnsubscribe.php similarity index 80% rename from lib/Predis/Commands/Unsubscribe.php rename to lib/Predis/Commands/PubSubUnsubscribe.php index 42ad1862..fd861e61 100644 --- a/lib/Predis/Commands/Unsubscribe.php +++ b/lib/Predis/Commands/PubSubUnsubscribe.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Unsubscribe extends Command { +class PubSubUnsubscribe extends Command { public function getId() { return 'UNSUBSCRIBE'; } diff --git a/lib/Predis/Commands/UnsubscribeByPattern.php b/lib/Predis/Commands/PubSubUnsubscribeByPattern.php similarity index 77% rename from lib/Predis/Commands/UnsubscribeByPattern.php rename to lib/Predis/Commands/PubSubUnsubscribeByPattern.php index 47b106d8..eead9b63 100644 --- a/lib/Predis/Commands/UnsubscribeByPattern.php +++ b/lib/Predis/Commands/PubSubUnsubscribeByPattern.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class UnsubscribeByPattern extends Command { +class PubSubUnsubscribeByPattern extends Command { public function getId() { return 'PUNSUBSCRIBE'; } diff --git a/lib/Predis/Commands/BackgroundRewriteAppendOnlyFile.php b/lib/Predis/Commands/ServerBackgroundRewriteAOF.php similarity index 84% rename from lib/Predis/Commands/BackgroundRewriteAppendOnlyFile.php rename to lib/Predis/Commands/ServerBackgroundRewriteAOF.php index 07b4c3e4..2ea0111d 100644 --- a/lib/Predis/Commands/BackgroundRewriteAppendOnlyFile.php +++ b/lib/Predis/Commands/ServerBackgroundRewriteAOF.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class BackgroundRewriteAppendOnlyFile extends Command { +class ServerBackgroundRewriteAOF extends Command { public function getId() { return 'BGREWRITEAOF'; } diff --git a/lib/Predis/Commands/BackgroundSave.php b/lib/Predis/Commands/ServerBackgroundSave.php similarity index 87% rename from lib/Predis/Commands/BackgroundSave.php rename to lib/Predis/Commands/ServerBackgroundSave.php index 7c1e0ef1..ebf5d13f 100644 --- a/lib/Predis/Commands/BackgroundSave.php +++ b/lib/Predis/Commands/ServerBackgroundSave.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class BackgroundSave extends Command { +class ServerBackgroundSave extends Command { public function getId() { return 'BGSAVE'; } diff --git a/lib/Predis/Commands/Client.php b/lib/Predis/Commands/ServerClient.php similarity index 96% rename from lib/Predis/Commands/Client.php rename to lib/Predis/Commands/ServerClient.php index 35a624dd..1642895a 100644 --- a/lib/Predis/Commands/Client.php +++ b/lib/Predis/Commands/ServerClient.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Client extends Command { +class ServerClient extends Command { public function getId() { return 'CLIENT'; } diff --git a/lib/Predis/Commands/Config.php b/lib/Predis/Commands/ServerConfig.php similarity index 81% rename from lib/Predis/Commands/Config.php rename to lib/Predis/Commands/ServerConfig.php index 2faa9bee..f0a3bda9 100644 --- a/lib/Predis/Commands/Config.php +++ b/lib/Predis/Commands/ServerConfig.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Config extends Command { +class ServerConfig extends Command { public function getId() { return 'CONFIG'; } diff --git a/lib/Predis/Commands/DatabaseSize.php b/lib/Predis/Commands/ServerDatabaseSize.php similarity index 79% rename from lib/Predis/Commands/DatabaseSize.php rename to lib/Predis/Commands/ServerDatabaseSize.php index 0768ea89..72d2bdf0 100644 --- a/lib/Predis/Commands/DatabaseSize.php +++ b/lib/Predis/Commands/ServerDatabaseSize.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class DatabaseSize extends Command { +class ServerDatabaseSize extends Command { public function getId() { return 'DBSIZE'; } diff --git a/lib/Predis/Commands/FlushAll.php b/lib/Predis/Commands/ServerFlushAll.php similarity index 81% rename from lib/Predis/Commands/FlushAll.php rename to lib/Predis/Commands/ServerFlushAll.php index 953e4409..6bd02341 100644 --- a/lib/Predis/Commands/FlushAll.php +++ b/lib/Predis/Commands/ServerFlushAll.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class FlushAll extends Command { +class ServerFlushAll extends Command { public function getId() { return 'FLUSHALL'; } diff --git a/lib/Predis/Commands/FlushDatabase.php b/lib/Predis/Commands/ServerFlushDatabase.php similarity index 79% rename from lib/Predis/Commands/FlushDatabase.php rename to lib/Predis/Commands/ServerFlushDatabase.php index d9f05294..57fa6827 100644 --- a/lib/Predis/Commands/FlushDatabase.php +++ b/lib/Predis/Commands/ServerFlushDatabase.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class FlushDatabase extends Command { +class ServerFlushDatabase extends Command { public function getId() { return 'FLUSHDB'; } diff --git a/lib/Predis/Commands/Info.php b/lib/Predis/Commands/ServerInfo.php similarity index 97% rename from lib/Predis/Commands/Info.php rename to lib/Predis/Commands/ServerInfo.php index c6d244ad..eed1f662 100644 --- a/lib/Predis/Commands/Info.php +++ b/lib/Predis/Commands/ServerInfo.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class Info extends Command { +class ServerInfo extends Command { public function getId() { return 'INFO'; } diff --git a/lib/Predis/Commands/InfoV24x.php b/lib/Predis/Commands/ServerInfoV24x.php similarity index 95% rename from lib/Predis/Commands/InfoV24x.php rename to lib/Predis/Commands/ServerInfoV24x.php index f27645e1..0da4df2c 100644 --- a/lib/Predis/Commands/InfoV24x.php +++ b/lib/Predis/Commands/ServerInfoV24x.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class InfoV24x extends Info { +class ServerInfoV24x extends ServerInfo { public function parseResponse($data) { $info = array(); $current = null; diff --git a/lib/Predis/Commands/LastSave.php b/lib/Predis/Commands/ServerLastSave.php similarity index 81% rename from lib/Predis/Commands/LastSave.php rename to lib/Predis/Commands/ServerLastSave.php index 49768e8f..34dbbc18 100644 --- a/lib/Predis/Commands/LastSave.php +++ b/lib/Predis/Commands/ServerLastSave.php @@ -2,7 +2,7 @@ namespace Predis\Commands; -class LastSave extends Command { +class ServerLastSave extends Command { public function getId() { return 'LASTSAVE'; } diff --git a/lib/Predis/Commands/ServerMonitor.php b/lib/Predis/Commands/ServerMonitor.php new file mode 100644 index 00000000..2f06b408 --- /dev/null +++ b/lib/Predis/Commands/ServerMonitor.php @@ -0,0 +1,13 @@ + '\Predis\Commands\Ping', - 'echo' => '\Predis\Commands\DoEcho', - 'auth' => '\Predis\Commands\Auth', - - /* connection handling */ - 'quit' => '\Predis\Commands\Quit', + /* commands operating on the key space */ + 'exists' => '\Predis\Commands\KeyExists', + 'del' => '\Predis\Commands\KeyDelete', + 'type' => '\Predis\Commands\KeyType', + 'keys' => '\Predis\Commands\KeyKeysV12x', + 'randomkey' => '\Predis\Commands\KeyRandom', + 'rename' => '\Predis\Commands\KeyRename', + 'renamenx' => '\Predis\Commands\KeyRenamePreserve', + 'expire' => '\Predis\Commands\KeyExpire', + 'expireat' => '\Predis\Commands\KeyExpireAt', + 'ttl' => '\Predis\Commands\KeyTimeToLive', + 'move' => '\Predis\Commands\KeyMove', + 'sort' => '\Predis\Commands\KeySort', /* commands operating on string values */ - 'set' => '\Predis\Commands\Set', - 'setnx' => '\Predis\Commands\SetPreserve', - 'mset' => '\Predis\Commands\SetMultiple', - 'msetnx' => '\Predis\Commands\SetMultiplePreserve', - 'get' => '\Predis\Commands\Get', - 'mget' => '\Predis\Commands\GetMultiple', - 'getset' => '\Predis\Commands\GetSet', - 'incr' => '\Predis\Commands\Increment', - 'incrby' => '\Predis\Commands\IncrementBy', - 'decr' => '\Predis\Commands\Decrement', - 'decrby' => '\Predis\Commands\DecrementBy', - 'exists' => '\Predis\Commands\Exists', - 'del' => '\Predis\Commands\Delete', - 'type' => '\Predis\Commands\Type', - - /* commands operating on the key space */ - 'keys' => '\Predis\Commands\KeysV12x', - 'randomkey' => '\Predis\Commands\RandomKey', - 'rename' => '\Predis\Commands\Rename', - 'renamenx' => '\Predis\Commands\RenamePreserve', - 'expire' => '\Predis\Commands\Expire', - 'expireat' => '\Predis\Commands\ExpireAt', - 'dbsize' => '\Predis\Commands\DatabaseSize', - 'ttl' => '\Predis\Commands\TimeToLive', + 'set' => '\Predis\Commands\StringSet', + 'setnx' => '\Predis\Commands\StringSetPreserve', + 'mset' => '\Predis\Commands\StringSetMultiple', + 'msetnx' => '\Predis\Commands\StringSetMultiplePreserve', + 'get' => '\Predis\Commands\StringGet', + 'mget' => '\Predis\Commands\StringGetMultiple', + 'getset' => '\Predis\Commands\StringGetSet', + 'incr' => '\Predis\Commands\StringIncrement', + 'incrby' => '\Predis\Commands\StringIncrementBy', + 'decr' => '\Predis\Commands\StringDecrement', + 'decrby' => '\Predis\Commands\StringDecrementBy', /* commands operating on lists */ 'rpush' => '\Predis\Commands\ListPushTail', @@ -82,26 +75,25 @@ class ServerVersion12 extends ServerProfile { 'zscore' => '\Predis\Commands\ZSetScore', 'zremrangebyscore' => '\Predis\Commands\ZSetRemoveRangeByScore', - /* multiple databases handling commands */ - 'select' => '\Predis\Commands\SelectDatabase', - 'move' => '\Predis\Commands\MoveKey', - 'flushdb' => '\Predis\Commands\FlushDatabase', - 'flushall' => '\Predis\Commands\FlushAll', - - /* sorting */ - 'sort' => '\Predis\Commands\Sort', + /* connection related commands */ + 'ping' => '\Predis\Commands\ConnectionPing', + 'auth' => '\Predis\Commands\ConnectionAuth', + 'select' => '\Predis\Commands\ConnectionSelect', + 'echo' => '\Predis\Commands\ConnectionEcho', + 'quit' => '\Predis\Commands\ConnectionQuit', /* remote server control commands */ - 'info' => '\Predis\Commands\Info', - 'slaveof' => '\Predis\Commands\SlaveOf', - 'monitor' => '\Predis\Commands\Monitor', - - /* persistence control commands */ - 'save' => '\Predis\Commands\Save', - 'bgsave' => '\Predis\Commands\BackgroundSave', - 'lastsave' => '\Predis\Commands\LastSave', - 'shutdown' => '\Predis\Commands\Shutdown', - 'bgrewriteaof' => '\Predis\Commands\BackgroundRewriteAppendOnlyFile', + 'info' => '\Predis\Commands\ServerInfo', + 'slaveof' => '\Predis\Commands\ServerSlaveOf', + 'monitor' => '\Predis\Commands\ServerMonitor', + 'dbsize' => '\Predis\Commands\ServerDatabaseSize', + 'flushdb' => '\Predis\Commands\ServerFlushDatabase', + 'flushall' => '\Predis\Commands\ServerFlushAll', + 'save' => '\Predis\Commands\ServerSave', + 'bgsave' => '\Predis\Commands\ServerBackgroundSave', + 'lastsave' => '\Predis\Commands\ServerLastSave', + 'shutdown' => '\Predis\Commands\ServerShutdown', + 'bgrewriteaof' => '\Predis\Commands\ServerBackgroundRewriteAOF', ); } } diff --git a/lib/Predis/Profiles/ServerVersion20.php b/lib/Predis/Profiles/ServerVersion20.php index 4b81c916..8bedaf3b 100644 --- a/lib/Predis/Profiles/ServerVersion20.php +++ b/lib/Predis/Profiles/ServerVersion20.php @@ -8,39 +8,32 @@ class ServerVersion20 extends ServerProfile { return array( /* ---------------- Redis 1.2 ---------------- */ - /* miscellaneous commands */ - 'ping' => '\Predis\Commands\Ping', - 'echo' => '\Predis\Commands\DoEcho', - 'auth' => '\Predis\Commands\Auth', - - /* connection handling */ - 'quit' => '\Predis\Commands\Quit', + /* commands operating on the key space */ + 'exists' => '\Predis\Commands\KeyExists', + 'del' => '\Predis\Commands\KeyDelete', + 'type' => '\Predis\Commands\KeyType', + 'keys' => '\Predis\Commands\KeyKeys', + 'randomkey' => '\Predis\Commands\KeyRandom', + 'rename' => '\Predis\Commands\KeyRename', + 'renamenx' => '\Predis\Commands\KeyRenamePreserve', + 'expire' => '\Predis\Commands\KeyExpire', + 'expireat' => '\Predis\Commands\KeyExpireAt', + 'ttl' => '\Predis\Commands\KeyTimeToLive', + 'move' => '\Predis\Commands\KeyMove', + 'sort' => '\Predis\Commands\KeySort', /* commands operating on string values */ - 'set' => '\Predis\Commands\Set', - 'setnx' => '\Predis\Commands\SetPreserve', - 'mset' => '\Predis\Commands\SetMultiple', - 'msetnx' => '\Predis\Commands\SetMultiplePreserve', - 'get' => '\Predis\Commands\Get', - 'mget' => '\Predis\Commands\GetMultiple', - 'getset' => '\Predis\Commands\GetSet', - 'incr' => '\Predis\Commands\Increment', - 'incrby' => '\Predis\Commands\IncrementBy', - 'decr' => '\Predis\Commands\Decrement', - 'decrby' => '\Predis\Commands\DecrementBy', - 'exists' => '\Predis\Commands\Exists', - 'del' => '\Predis\Commands\Delete', - 'type' => '\Predis\Commands\Type', - - /* commands operating on the key space */ - 'keys' => '\Predis\Commands\Keys', - 'randomkey' => '\Predis\Commands\RandomKey', - 'rename' => '\Predis\Commands\Rename', - 'renamenx' => '\Predis\Commands\RenamePreserve', - 'expire' => '\Predis\Commands\Expire', - 'expireat' => '\Predis\Commands\ExpireAt', - 'dbsize' => '\Predis\Commands\DatabaseSize', - 'ttl' => '\Predis\Commands\TimeToLive', + 'set' => '\Predis\Commands\StringSet', + 'setnx' => '\Predis\Commands\StringSetPreserve', + 'mset' => '\Predis\Commands\StringSetMultiple', + 'msetnx' => '\Predis\Commands\StringSetMultiplePreserve', + 'get' => '\Predis\Commands\StringGet', + 'mget' => '\Predis\Commands\StringGetMultiple', + 'getset' => '\Predis\Commands\StringGetSet', + 'incr' => '\Predis\Commands\StringIncrement', + 'incrby' => '\Predis\Commands\StringIncrementBy', + 'decr' => '\Predis\Commands\StringDecrement', + 'decrby' => '\Predis\Commands\StringDecrementBy', /* commands operating on lists */ 'rpush' => '\Predis\Commands\ListPushTail', @@ -82,39 +75,33 @@ class ServerVersion20 extends ServerProfile { 'zscore' => '\Predis\Commands\ZSetScore', 'zremrangebyscore' => '\Predis\Commands\ZSetRemoveRangeByScore', - /* multiple databases handling commands */ - 'select' => '\Predis\Commands\SelectDatabase', - 'move' => '\Predis\Commands\MoveKey', - 'flushdb' => '\Predis\Commands\FlushDatabase', - 'flushall' => '\Predis\Commands\FlushAll', - - /* sorting */ - 'sort' => '\Predis\Commands\Sort', + /* connection related commands */ + 'ping' => '\Predis\Commands\ConnectionPing', + 'auth' => '\Predis\Commands\ConnectionAuth', + 'select' => '\Predis\Commands\ConnectionSelect', + 'echo' => '\Predis\Commands\ConnectionEcho', + 'quit' => '\Predis\Commands\ConnectionQuit', /* remote server control commands */ - 'info' => '\Predis\Commands\Info', - 'slaveof' => '\Predis\Commands\SlaveOf', - 'monitor' => '\Predis\Commands\Monitor', - - /* persistence control commands */ - 'save' => '\Predis\Commands\Save', - 'bgsave' => '\Predis\Commands\BackgroundSave', - 'lastsave' => '\Predis\Commands\LastSave', - 'shutdown' => '\Predis\Commands\Shutdown', - 'bgrewriteaof' => '\Predis\Commands\BackgroundRewriteAppendOnlyFile', + 'info' => '\Predis\Commands\ServerInfo', + 'slaveof' => '\Predis\Commands\ServerSlaveOf', + 'monitor' => '\Predis\Commands\ServerMonitor', + 'dbsize' => '\Predis\Commands\ServerDatabaseSize', + 'flushdb' => '\Predis\Commands\ServerFlushDatabase', + 'flushall' => '\Predis\Commands\ServerFlushAll', + 'save' => '\Predis\Commands\ServerSave', + 'bgsave' => '\Predis\Commands\ServerBackgroundSave', + 'lastsave' => '\Predis\Commands\ServerLastSave', + 'shutdown' => '\Predis\Commands\ServerShutdown', + 'bgrewriteaof' => '\Predis\Commands\ServerBackgroundRewriteAOF', /* ---------------- Redis 2.0 ---------------- */ - /* transactions */ - 'multi' => '\Predis\Commands\Multi', - 'exec' => '\Predis\Commands\Exec', - 'discard' => '\Predis\Commands\Discard', - /* commands operating on string values */ - 'setex' => '\Predis\Commands\SetExpire', - 'append' => '\Predis\Commands\Append', - 'substr' => '\Predis\Commands\Substr', + 'setex' => '\Predis\Commands\StringSetExpire', + 'append' => '\Predis\Commands\StringAppend', + 'substr' => '\Predis\Commands\StringSubstr', /* commands operating on lists */ 'blpop' => '\Predis\Commands\ListPopFirstBlocking', @@ -142,15 +129,20 @@ class ServerVersion20 extends ServerProfile { 'hvals' => '\Predis\Commands\HashValues', 'hgetall' => '\Predis\Commands\HashGetAll', + /* transactions */ + 'multi' => '\Predis\Commands\TransactionMulti', + 'exec' => '\Predis\Commands\TransactionExec', + 'discard' => '\Predis\Commands\TransactionDiscard', + /* publish - subscribe */ - 'subscribe' => '\Predis\Commands\Subscribe', - 'unsubscribe' => '\Predis\Commands\Unsubscribe', - 'psubscribe' => '\Predis\Commands\SubscribeByPattern', - 'punsubscribe' => '\Predis\Commands\UnsubscribeByPattern', - 'publish' => '\Predis\Commands\Publish', + 'subscribe' => '\Predis\Commands\PubSubSubscribe', + 'unsubscribe' => '\Predis\Commands\PubSubUnsubscribe', + 'psubscribe' => '\Predis\Commands\PubSubSubscribeByPattern', + 'punsubscribe' => '\Predis\Commands\PubSubUnsubscribeByPattern', + 'publish' => '\Predis\Commands\PubSubPublish', /* remote server control commands */ - 'config' => '\Predis\Commands\Config', + 'config' => '\Predis\Commands\ServerConfig', ); } } diff --git a/lib/Predis/Profiles/ServerVersion22.php b/lib/Predis/Profiles/ServerVersion22.php index 438a322c..94760531 100644 --- a/lib/Predis/Profiles/ServerVersion22.php +++ b/lib/Predis/Profiles/ServerVersion22.php @@ -8,39 +8,32 @@ class ServerVersion22 extends ServerProfile { return array( /* ---------------- Redis 1.2 ---------------- */ - /* miscellaneous commands */ - 'ping' => '\Predis\Commands\Ping', - 'echo' => '\Predis\Commands\DoEcho', - 'auth' => '\Predis\Commands\Auth', - - /* connection handling */ - 'quit' => '\Predis\Commands\Quit', + /* commands operating on the key space */ + 'exists' => '\Predis\Commands\KeyExists', + 'del' => '\Predis\Commands\KeyDelete', + 'type' => '\Predis\Commands\KeyType', + 'keys' => '\Predis\Commands\KeyKeys', + 'randomkey' => '\Predis\Commands\KeyRandom', + 'rename' => '\Predis\Commands\KeyRename', + 'renamenx' => '\Predis\Commands\KeyRenamePreserve', + 'expire' => '\Predis\Commands\KeyExpire', + 'expireat' => '\Predis\Commands\KeyExpireAt', + 'ttl' => '\Predis\Commands\KeyTimeToLive', + 'move' => '\Predis\Commands\KeyMove', + 'sort' => '\Predis\Commands\KeySort', /* commands operating on string values */ - 'set' => '\Predis\Commands\Set', - 'setnx' => '\Predis\Commands\SetPreserve', - 'mset' => '\Predis\Commands\SetMultiple', - 'msetnx' => '\Predis\Commands\SetMultiplePreserve', - 'get' => '\Predis\Commands\Get', - 'mget' => '\Predis\Commands\GetMultiple', - 'getset' => '\Predis\Commands\GetSet', - 'incr' => '\Predis\Commands\Increment', - 'incrby' => '\Predis\Commands\IncrementBy', - 'decr' => '\Predis\Commands\Decrement', - 'decrby' => '\Predis\Commands\DecrementBy', - 'exists' => '\Predis\Commands\Exists', - 'del' => '\Predis\Commands\Delete', - 'type' => '\Predis\Commands\Type', - - /* commands operating on the key space */ - 'keys' => '\Predis\Commands\Keys', - 'randomkey' => '\Predis\Commands\RandomKey', - 'rename' => '\Predis\Commands\Rename', - 'renamenx' => '\Predis\Commands\RenamePreserve', - 'expire' => '\Predis\Commands\Expire', - 'expireat' => '\Predis\Commands\ExpireAt', - 'dbsize' => '\Predis\Commands\DatabaseSize', - 'ttl' => '\Predis\Commands\TimeToLive', + 'set' => '\Predis\Commands\StringSet', + 'setnx' => '\Predis\Commands\StringSetPreserve', + 'mset' => '\Predis\Commands\StringSetMultiple', + 'msetnx' => '\Predis\Commands\StringSetMultiplePreserve', + 'get' => '\Predis\Commands\StringGet', + 'mget' => '\Predis\Commands\StringGetMultiple', + 'getset' => '\Predis\Commands\StringGetSet', + 'incr' => '\Predis\Commands\StringIncrement', + 'incrby' => '\Predis\Commands\StringIncrementBy', + 'decr' => '\Predis\Commands\StringDecrement', + 'decrby' => '\Predis\Commands\StringDecrementBy', /* commands operating on lists */ 'rpush' => '\Predis\Commands\ListPushTail', @@ -82,39 +75,33 @@ class ServerVersion22 extends ServerProfile { 'zscore' => '\Predis\Commands\ZSetScore', 'zremrangebyscore' => '\Predis\Commands\ZSetRemoveRangeByScore', - /* multiple databases handling commands */ - 'select' => '\Predis\Commands\SelectDatabase', - 'move' => '\Predis\Commands\MoveKey', - 'flushdb' => '\Predis\Commands\FlushDatabase', - 'flushall' => '\Predis\Commands\FlushAll', - - /* sorting */ - 'sort' => '\Predis\Commands\Sort', + /* connection related commands */ + 'ping' => '\Predis\Commands\ConnectionPing', + 'auth' => '\Predis\Commands\ConnectionAuth', + 'select' => '\Predis\Commands\ConnectionSelect', + 'echo' => '\Predis\Commands\ConnectionEcho', + 'quit' => '\Predis\Commands\ConnectionQuit', /* remote server control commands */ - 'info' => '\Predis\Commands\Info', - 'slaveof' => '\Predis\Commands\SlaveOf', - 'monitor' => '\Predis\Commands\Monitor', - - /* persistence control commands */ - 'save' => '\Predis\Commands\Save', - 'bgsave' => '\Predis\Commands\BackgroundSave', - 'lastsave' => '\Predis\Commands\LastSave', - 'shutdown' => '\Predis\Commands\Shutdown', - 'bgrewriteaof' => '\Predis\Commands\BackgroundRewriteAppendOnlyFile', + 'info' => '\Predis\Commands\ServerInfo', + 'slaveof' => '\Predis\Commands\ServerSlaveOf', + 'monitor' => '\Predis\Commands\ServerMonitor', + 'dbsize' => '\Predis\Commands\ServerDatabaseSize', + 'flushdb' => '\Predis\Commands\ServerFlushDatabase', + 'flushall' => '\Predis\Commands\ServerFlushAll', + 'save' => '\Predis\Commands\ServerSave', + 'bgsave' => '\Predis\Commands\ServerBackgroundSave', + 'lastsave' => '\Predis\Commands\ServerLastSave', + 'shutdown' => '\Predis\Commands\ServerShutdown', + 'bgrewriteaof' => '\Predis\Commands\ServerBackgroundRewriteAOF', /* ---------------- Redis 2.0 ---------------- */ - /* transactions */ - 'multi' => '\Predis\Commands\Multi', - 'exec' => '\Predis\Commands\Exec', - 'discard' => '\Predis\Commands\Discard', - /* commands operating on string values */ - 'setex' => '\Predis\Commands\SetExpire', - 'append' => '\Predis\Commands\Append', - 'substr' => '\Predis\Commands\Substr', + 'setex' => '\Predis\Commands\StringSetExpire', + 'append' => '\Predis\Commands\StringAppend', + 'substr' => '\Predis\Commands\StringSubstr', /* commands operating on lists */ 'blpop' => '\Predis\Commands\ListPopFirstBlocking', @@ -142,32 +129,33 @@ class ServerVersion22 extends ServerProfile { 'hvals' => '\Predis\Commands\HashValues', 'hgetall' => '\Predis\Commands\HashGetAll', + /* transactions */ + 'multi' => '\Predis\Commands\TransactionMulti', + 'exec' => '\Predis\Commands\TransactionExec', + 'discard' => '\Predis\Commands\TransactionDiscard', + /* publish - subscribe */ - 'subscribe' => '\Predis\Commands\Subscribe', - 'unsubscribe' => '\Predis\Commands\Unsubscribe', - 'psubscribe' => '\Predis\Commands\SubscribeByPattern', - 'punsubscribe' => '\Predis\Commands\UnsubscribeByPattern', - 'publish' => '\Predis\Commands\Publish', + 'subscribe' => '\Predis\Commands\PubSubSubscribe', + 'unsubscribe' => '\Predis\Commands\PubSubUnsubscribe', + 'psubscribe' => '\Predis\Commands\PubSubSubscribeByPattern', + 'punsubscribe' => '\Predis\Commands\PubSubUnsubscribeByPattern', + 'publish' => '\Predis\Commands\PubSubPublish', /* remote server control commands */ - 'config' => '\Predis\Commands\Config', + 'config' => '\Predis\Commands\ServerConfig', /* ---------------- Redis 2.2 ---------------- */ - /* transactions */ - 'watch' => '\Predis\Commands\Watch', - 'unwatch' => '\Predis\Commands\Unwatch', + /* commands operating on the key space */ + 'persist' => '\Predis\Commands\KeyPersist', /* commands operating on string values */ - 'strlen' => '\Predis\Commands\Strlen', - 'setrange' => '\Predis\Commands\SetRange', - 'getrange' => '\Predis\Commands\GetRange', - 'setbit' => '\Predis\Commands\SetBit', - 'getbit' => '\Predis\Commands\GetBit', - - /* commands operating on the key space */ - 'persist' => '\Predis\Commands\Persist', + 'strlen' => '\Predis\Commands\StringStrlen', + 'setrange' => '\Predis\Commands\StringSetRange', + 'getrange' => '\Predis\Commands\StringGetRange', + 'setbit' => '\Predis\Commands\StringSetBit', + 'getbit' => '\Predis\Commands\StringGetBit', /* commands operating on lists */ 'rpushx' => '\Predis\Commands\ListPushTailX', @@ -178,8 +166,12 @@ class ServerVersion22 extends ServerProfile { /* commands operating on sorted sets */ 'zrevrangebyscore' => '\Predis\Commands\ZSetReverseRangeByScore', + /* transactions */ + 'watch' => '\Predis\Commands\TransactionWatch', + 'unwatch' => '\Predis\Commands\TransactionUnwatch', + /* remote server control commands */ - 'object' => '\Predis\Commands\DebugObject', + 'object' => '\Predis\Commands\ServerObject', ); } } diff --git a/lib/Predis/Profiles/ServerVersionNext.php b/lib/Predis/Profiles/ServerVersionNext.php index df06525d..e1793d5d 100644 --- a/lib/Predis/Profiles/ServerVersionNext.php +++ b/lib/Predis/Profiles/ServerVersionNext.php @@ -18,8 +18,8 @@ class ServerVersionNext extends ServerVersion22 { 'hdel' => '\Predis\Commands\HashDeleteV24x', /* remote server control commands */ - 'info' => '\Predis\Commands\InfoV24x', - 'client' => '\Predis\Commands\Client', + 'info' => '\Predis\Commands\ServerInfoV24x', + 'client' => '\Predis\Commands\ServerClient', )); } } diff --git a/test/ClientFeaturesTest.php b/test/ClientFeaturesTest.php index 01c98c0b..b5f41385 100644 --- a/test/ClientFeaturesTest.php +++ b/test/ClientFeaturesTest.php @@ -64,28 +64,28 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { function testCommand_TestArguments() { $cmdArgs = array('key1', 'key2', 'key3'); - $cmd = new \Predis\Commands\GetMultiple(); + $cmd = new \Predis\Commands\StringGetMultiple(); $cmd->setArguments($cmdArgs); $this->assertEquals($cmdArgs[0], $cmd->getArgument(0)); $this->assertEquals($cmdArgs[1], $cmd->getArgument(1)); $this->assertEquals($cmdArgs[2], $cmd->getArgument(2)); - $cmd = new \Predis\Commands\Ping(); + $cmd = new \Predis\Commands\ConnectionPing(); $this->assertNull($cmd->getArgument(0)); } function testCommand_ParseResponse() { // default parser - $cmd = new \Predis\Commands\Get(); + $cmd = new \Predis\Commands\StringGet(); $this->assertEquals('test', $cmd->parseResponse('test')); // overridden parser (boolean) - $cmd = new \Predis\Commands\Exists(); + $cmd = new \Predis\Commands\KeyExists(); $this->assertTrue($cmd->parseResponse('1')); $this->assertFalse($cmd->parseResponse('0')); // overridden parser (boolean) - $cmd = new \Predis\Commands\Ping(); + $cmd = new \Predis\Commands\ConnectionPing(); $this->assertTrue($cmd->parseResponse('PONG')); // overridden parser (complex) @@ -122,12 +122,12 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $profile = \Predis\Profiles\ServerProfile::get('2.0'); $cmdNoArgs = $profile->createCommand('info'); - $this->assertInstanceOf('\Predis\Commands\Info', $cmdNoArgs); + $this->assertInstanceOf('\Predis\Commands\ServerInfo', $cmdNoArgs); $this->assertNull($cmdNoArgs->getArgument()); $args = array('key1', 'key2'); $cmdWithArgs = $profile->createCommand('mget', $args); - $this->assertInstanceOf('\Predis\Commands\GetMultiple', $cmdWithArgs); + $this->assertInstanceOf('\Predis\Commands\StringGetMultiple', $cmdWithArgs); $this->assertEquals($args[0], $cmdWithArgs->getArgument()); // TODO: why? $this->assertEquals($args[0], $cmdWithArgs->getArgument(0)); $this->assertEquals($args[1], $cmdWithArgs->getArgument(1)); @@ -144,7 +144,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { function testServerProfile_CommandsRegistration() { $profile = \Predis\Profiles\ServerProfile::get('1.2'); $cmdId = 'multi'; - $cmdClass = '\Predis\Commands\Multi'; + $cmdClass = '\Predis\Commands\TransactionMulti'; $this->assertFalse($profile->supportsCommand($cmdId)); $profile->defineCommand($cmdId, new $cmdClass());