Add dedicated server profile for Redis 3.0.

This commit is contained in:
Daniele Alessandri
2014-07-18 13:10:52 +02:00
parent adb4d82ea8
commit ba6cfa7887
4 changed files with 447 additions and 1 deletions
+1
View File
@@ -78,6 +78,7 @@ abstract class ServerProfile implements ServerProfileInterface, CommandProcessin
'2.4' => 'Predis\Profile\ServerVersion24',
'2.6' => 'Predis\Profile\ServerVersion26',
'2.8' => 'Predis\Profile\ServerVersion28',
'3.0' => 'Predis\Profile\ServerVersion30',
'default' => 'Predis\Profile\ServerVersion28',
'dev' => 'Predis\Profile\ServerVersionNext',
);
+257
View File
@@ -0,0 +1,257 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) Daniele Alessandri <suppakilla@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Profile;
/**
* Server profile for Redis v3.0.x.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ServerVersion30 extends ServerProfile
{
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '3.0';
}
/**
* {@inheritdoc}
*/
public function getSupportedCommands()
{
return array(
/* ---------------- Redis 1.2 ---------------- */
/* commands operating on the key space */
'exists' => 'Predis\Command\KeyExists',
'del' => 'Predis\Command\KeyDelete',
'type' => 'Predis\Command\KeyType',
'keys' => 'Predis\Command\KeyKeys',
'randomkey' => 'Predis\Command\KeyRandom',
'rename' => 'Predis\Command\KeyRename',
'renamenx' => 'Predis\Command\KeyRenamePreserve',
'expire' => 'Predis\Command\KeyExpire',
'expireat' => 'Predis\Command\KeyExpireAt',
'ttl' => 'Predis\Command\KeyTimeToLive',
'move' => 'Predis\Command\KeyMove',
'sort' => 'Predis\Command\KeySort',
'dump' => 'Predis\Command\KeyDump',
'restore' => 'Predis\Command\KeyRestore',
/* commands operating on string values */
'set' => 'Predis\Command\StringSet',
'setnx' => 'Predis\Command\StringSetPreserve',
'mset' => 'Predis\Command\StringSetMultiple',
'msetnx' => 'Predis\Command\StringSetMultiplePreserve',
'get' => 'Predis\Command\StringGet',
'mget' => 'Predis\Command\StringGetMultiple',
'getset' => 'Predis\Command\StringGetSet',
'incr' => 'Predis\Command\StringIncrement',
'incrby' => 'Predis\Command\StringIncrementBy',
'decr' => 'Predis\Command\StringDecrement',
'decrby' => 'Predis\Command\StringDecrementBy',
/* commands operating on lists */
'rpush' => 'Predis\Command\ListPushTail',
'lpush' => 'Predis\Command\ListPushHead',
'llen' => 'Predis\Command\ListLength',
'lrange' => 'Predis\Command\ListRange',
'ltrim' => 'Predis\Command\ListTrim',
'lindex' => 'Predis\Command\ListIndex',
'lset' => 'Predis\Command\ListSet',
'lrem' => 'Predis\Command\ListRemove',
'lpop' => 'Predis\Command\ListPopFirst',
'rpop' => 'Predis\Command\ListPopLast',
'rpoplpush' => 'Predis\Command\ListPopLastPushHead',
/* commands operating on sets */
'sadd' => 'Predis\Command\SetAdd',
'srem' => 'Predis\Command\SetRemove',
'spop' => 'Predis\Command\SetPop',
'smove' => 'Predis\Command\SetMove',
'scard' => 'Predis\Command\SetCardinality',
'sismember' => 'Predis\Command\SetIsMember',
'sinter' => 'Predis\Command\SetIntersection',
'sinterstore' => 'Predis\Command\SetIntersectionStore',
'sunion' => 'Predis\Command\SetUnion',
'sunionstore' => 'Predis\Command\SetUnionStore',
'sdiff' => 'Predis\Command\SetDifference',
'sdiffstore' => 'Predis\Command\SetDifferenceStore',
'smembers' => 'Predis\Command\SetMembers',
'srandmember' => 'Predis\Command\SetRandomMember',
/* commands operating on sorted sets */
'zadd' => 'Predis\Command\ZSetAdd',
'zincrby' => 'Predis\Command\ZSetIncrementBy',
'zrem' => 'Predis\Command\ZSetRemove',
'zrange' => 'Predis\Command\ZSetRange',
'zrevrange' => 'Predis\Command\ZSetReverseRange',
'zrangebyscore' => 'Predis\Command\ZSetRangeByScore',
'zcard' => 'Predis\Command\ZSetCardinality',
'zscore' => 'Predis\Command\ZSetScore',
'zremrangebyscore' => 'Predis\Command\ZSetRemoveRangeByScore',
/* connection related commands */
'ping' => 'Predis\Command\ConnectionPing',
'auth' => 'Predis\Command\ConnectionAuth',
'select' => 'Predis\Command\ConnectionSelect',
'echo' => 'Predis\Command\ConnectionEcho',
'quit' => 'Predis\Command\ConnectionQuit',
/* remote server control commands */
'info' => 'Predis\Command\ServerInfoV26x',
'slaveof' => 'Predis\Command\ServerSlaveOf',
'monitor' => 'Predis\Command\ServerMonitor',
'dbsize' => 'Predis\Command\ServerDatabaseSize',
'flushdb' => 'Predis\Command\ServerFlushDatabase',
'flushall' => 'Predis\Command\ServerFlushAll',
'save' => 'Predis\Command\ServerSave',
'bgsave' => 'Predis\Command\ServerBackgroundSave',
'lastsave' => 'Predis\Command\ServerLastSave',
'shutdown' => 'Predis\Command\ServerShutdown',
'bgrewriteaof' => 'Predis\Command\ServerBackgroundRewriteAOF',
/* ---------------- Redis 2.0 ---------------- */
/* commands operating on string values */
'setex' => 'Predis\Command\StringSetExpire',
'append' => 'Predis\Command\StringAppend',
'substr' => 'Predis\Command\StringSubstr',
/* commands operating on lists */
'blpop' => 'Predis\Command\ListPopFirstBlocking',
'brpop' => 'Predis\Command\ListPopLastBlocking',
/* commands operating on sorted sets */
'zunionstore' => 'Predis\Command\ZSetUnionStore',
'zinterstore' => 'Predis\Command\ZSetIntersectionStore',
'zcount' => 'Predis\Command\ZSetCount',
'zrank' => 'Predis\Command\ZSetRank',
'zrevrank' => 'Predis\Command\ZSetReverseRank',
'zremrangebyrank' => 'Predis\Command\ZSetRemoveRangeByRank',
/* commands operating on hashes */
'hset' => 'Predis\Command\HashSet',
'hsetnx' => 'Predis\Command\HashSetPreserve',
'hmset' => 'Predis\Command\HashSetMultiple',
'hincrby' => 'Predis\Command\HashIncrementBy',
'hget' => 'Predis\Command\HashGet',
'hmget' => 'Predis\Command\HashGetMultiple',
'hdel' => 'Predis\Command\HashDelete',
'hexists' => 'Predis\Command\HashExists',
'hlen' => 'Predis\Command\HashLength',
'hkeys' => 'Predis\Command\HashKeys',
'hvals' => 'Predis\Command\HashValues',
'hgetall' => 'Predis\Command\HashGetAll',
/* transactions */
'multi' => 'Predis\Command\TransactionMulti',
'exec' => 'Predis\Command\TransactionExec',
'discard' => 'Predis\Command\TransactionDiscard',
/* publish - subscribe */
'subscribe' => 'Predis\Command\PubSubSubscribe',
'unsubscribe' => 'Predis\Command\PubSubUnsubscribe',
'psubscribe' => 'Predis\Command\PubSubSubscribeByPattern',
'punsubscribe' => 'Predis\Command\PubSubUnsubscribeByPattern',
'publish' => 'Predis\Command\PubSubPublish',
/* remote server control commands */
'config' => 'Predis\Command\ServerConfig',
/* ---------------- Redis 2.2 ---------------- */
/* commands operating on the key space */
'persist' => 'Predis\Command\KeyPersist',
/* commands operating on string values */
'strlen' => 'Predis\Command\StringStrlen',
'setrange' => 'Predis\Command\StringSetRange',
'getrange' => 'Predis\Command\StringGetRange',
'setbit' => 'Predis\Command\StringSetBit',
'getbit' => 'Predis\Command\StringGetBit',
/* commands operating on lists */
'rpushx' => 'Predis\Command\ListPushTailX',
'lpushx' => 'Predis\Command\ListPushHeadX',
'linsert' => 'Predis\Command\ListInsert',
'brpoplpush' => 'Predis\Command\ListPopLastPushHeadBlocking',
/* commands operating on sorted sets */
'zrevrangebyscore' => 'Predis\Command\ZSetReverseRangeByScore',
/* transactions */
'watch' => 'Predis\Command\TransactionWatch',
'unwatch' => 'Predis\Command\TransactionUnwatch',
/* remote server control commands */
'object' => 'Predis\Command\ServerObject',
'slowlog' => 'Predis\Command\ServerSlowlog',
/* ---------------- Redis 2.4 ---------------- */
/* remote server control commands */
'client' => 'Predis\Command\ServerClient',
/* ---------------- Redis 2.6 ---------------- */
/* commands operating on the key space */
'pttl' => 'Predis\Command\KeyPreciseTimeToLive',
'pexpire' => 'Predis\Command\KeyPreciseExpire',
'pexpireat' => 'Predis\Command\KeyPreciseExpireAt',
/* commands operating on string values */
'psetex' => 'Predis\Command\StringPreciseSetExpire',
'incrbyfloat' => 'Predis\Command\StringIncrementByFloat',
'bitop' => 'Predis\Command\StringBitOp',
'bitcount' => 'Predis\Command\StringBitCount',
/* commands operating on hashes */
'hincrbyfloat' => 'Predis\Command\HashIncrementByFloat',
/* scripting */
'eval' => 'Predis\Command\ServerEval',
'evalsha' => 'Predis\Command\ServerEvalSHA',
'script' => 'Predis\Command\ServerScript',
/* remote server control commands */
'time' => 'Predis\Command\ServerTime',
/* ---------------- Redis 2.8 ---------------- */
/* commands operating on the key space */
'scan' => 'Predis\Command\KeyScan',
/* commands operating on sets */
'sscan' => 'Predis\Command\SetScan',
/* commands operating on sorted sets */
'zscan' => 'Predis\Command\ZSetScan',
'zlexcount' => 'Predis\Command\ZSetLexCount',
'zrangebylex' => 'Predis\Command\ZSetRangeByLex',
'zremrangebylex' => 'Predis\Command\ZSetRemoveRangeByLex',
/* commands operating on hashes */
'hscan' => 'Predis\Command\HashScan',
/* commands operating on HyperLogLog */
'pfadd' => 'Predis\Command\HyperLogLogAdd',
'pfcount' => 'Predis\Command\HyperLogLogCount',
'pfmerge' => 'Predis\Command\HyperLogLogMerge',
/* ---------------- Redis 3.0 ---------------- */
);
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace Predis\Profile;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ServerVersionNext extends ServerVersion28
class ServerVersionNext extends ServerVersion30
{
/**
* {@inheritdoc}
@@ -0,0 +1,188 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) Daniele Alessandri <suppakilla@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Profile;
/**
*
*/
class ServerVersion30Test extends PredisProfileTestCase
{
/**
* {@inheritdoc}
*/
public function getProfile($version = null)
{
return new ServerVersion30();
}
/**
* {@inheritdoc}
*/
public function getExpectedVersion()
{
return '3.0';
}
/**
* {@inheritdoc}
*/
public function getExpectedCommands()
{
return array(
0 => 'exists',
1 => 'del',
2 => 'type',
3 => 'keys',
4 => 'randomkey',
5 => 'rename',
6 => 'renamenx',
7 => 'expire',
8 => 'expireat',
9 => 'ttl',
10 => 'move',
11 => 'sort',
12 => 'dump',
13 => 'restore',
14 => 'set',
15 => 'setnx',
16 => 'mset',
17 => 'msetnx',
18 => 'get',
19 => 'mget',
20 => 'getset',
21 => 'incr',
22 => 'incrby',
23 => 'decr',
24 => 'decrby',
25 => 'rpush',
26 => 'lpush',
27 => 'llen',
28 => 'lrange',
29 => 'ltrim',
30 => 'lindex',
31 => 'lset',
32 => 'lrem',
33 => 'lpop',
34 => 'rpop',
35 => 'rpoplpush',
36 => 'sadd',
37 => 'srem',
38 => 'spop',
39 => 'smove',
40 => 'scard',
41 => 'sismember',
42 => 'sinter',
43 => 'sinterstore',
44 => 'sunion',
45 => 'sunionstore',
46 => 'sdiff',
47 => 'sdiffstore',
48 => 'smembers',
49 => 'srandmember',
50 => 'zadd',
51 => 'zincrby',
52 => 'zrem',
53 => 'zrange',
54 => 'zrevrange',
55 => 'zrangebyscore',
56 => 'zcard',
57 => 'zscore',
58 => 'zremrangebyscore',
59 => 'ping',
60 => 'auth',
61 => 'select',
62 => 'echo',
63 => 'quit',
64 => 'info',
65 => 'slaveof',
66 => 'monitor',
67 => 'dbsize',
68 => 'flushdb',
69 => 'flushall',
70 => 'save',
71 => 'bgsave',
72 => 'lastsave',
73 => 'shutdown',
74 => 'bgrewriteaof',
75 => 'setex',
76 => 'append',
77 => 'substr',
78 => 'blpop',
79 => 'brpop',
80 => 'zunionstore',
81 => 'zinterstore',
82 => 'zcount',
83 => 'zrank',
84 => 'zrevrank',
85 => 'zremrangebyrank',
86 => 'hset',
87 => 'hsetnx',
88 => 'hmset',
89 => 'hincrby',
90 => 'hget',
91 => 'hmget',
92 => 'hdel',
93 => 'hexists',
94 => 'hlen',
95 => 'hkeys',
96 => 'hvals',
97 => 'hgetall',
98 => 'multi',
99 => 'exec',
100 => 'discard',
101 => 'subscribe',
102 => 'unsubscribe',
103 => 'psubscribe',
104 => 'punsubscribe',
105 => 'publish',
106 => 'config',
107 => 'persist',
108 => 'strlen',
109 => 'setrange',
110 => 'getrange',
111 => 'setbit',
112 => 'getbit',
113 => 'rpushx',
114 => 'lpushx',
115 => 'linsert',
116 => 'brpoplpush',
117 => 'zrevrangebyscore',
118 => 'watch',
119 => 'unwatch',
120 => 'object',
121 => 'slowlog',
122 => 'client',
123 => 'pttl',
124 => 'pexpire',
125 => 'pexpireat',
126 => 'psetex',
127 => 'incrbyfloat',
128 => 'bitop',
129 => 'bitcount',
130 => 'hincrbyfloat',
131 => 'eval',
132 => 'evalsha',
133 => 'script',
134 => 'time',
135 => 'scan',
136 => 'sscan',
137 => 'zscan',
138 => 'zlexcount',
139 => 'zrangebylex',
140 => 'zremrangebylex',
141 => 'hscan',
142 => 'pfadd',
143 => 'pfcount',
144 => 'pfmerge',
);
}
}