Promote 2.6 as an independent server profile for Redis 2.6.

The development server profile now targets Redis 3.0.
This commit is contained in:
Daniele Alessandri
2012-03-11 17:49:18 +01:00
parent 7b01bc0644
commit da381fffa9
7 changed files with 415 additions and 27 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ project,
## Main features ##
- Complete support for Redis from __1.2__ to __2.4__ and the current development versions using different
- Complete support for Redis from __1.2__ to __2.6__ and the current unstable versions using different
server profiles.
- Client-side sharding with support for consistent hashing or custom distribution strategies.
- Support for master / slave replication configurations (write on master, read from slaves).
+1 -1
View File
@@ -76,7 +76,7 @@ abstract class ServerProfile implements ServerProfileInterface, CommandProcessin
'2.0' => 'Predis\Profile\ServerVersion20',
'2.2' => 'Predis\Profile\ServerVersion22',
'2.4' => 'Predis\Profile\ServerVersion24',
'2.6' => 'Predis\Profile\ServerVersionNext',
'2.6' => 'Predis\Profile\ServerVersion26',
'default' => 'Predis\Profile\ServerVersion24',
'dev' => 'Predis\Profile\ServerVersionNext',
);
+234
View File
@@ -0,0 +1,234 @@
<?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 v2.6.x.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ServerVersion26 extends ServerProfile
{
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '2.6';
}
/**
* {@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',
/* 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\ServerInfo',
'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',
/* 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 */
'info' => 'Predis\Command\ServerInfoV26x',
'time' => 'Predis\Command\ServerTime',
);
}
}
+3 -23
View File
@@ -12,18 +12,18 @@
namespace Predis\Profile;
/**
* Server profile for the current development version of Redis.
* Server profile for the current unstable version of Redis.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ServerVersionNext extends ServerVersion24
class ServerVersionNext extends ServerVersion26
{
/**
* {@inheritdoc}
*/
public function getVersion()
{
return '2.6';
return '3.0';
}
/**
@@ -32,26 +32,6 @@ class ServerVersionNext extends ServerVersion24
public function getSupportedCommands()
{
return array_merge(parent::getSupportedCommands(), array(
/* 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',
/* 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 */
'info' => 'Predis\Command\ServerInfoV26x',
'time' => 'Predis\Command\ServerTime',
));
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ use Predis\Command\Processor\ProcessorChain;
class ServerProfileTest extends StandardTestCase
{
const DEFAULT_PROFILE_VERSION = '2.4';
const DEVELOPMENT_PROFILE_VERSION = '2.6';
const DEVELOPMENT_PROFILE_VERSION = '3.0';
/**
* @group disconnected
@@ -0,0 +1,174 @@
<?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 ServerVersion26Test extends ServerVersionTestCase
{
/**
* {@inheritdoc}
*/
public function getProfileInstance()
{
return new ServerVersion26();
}
/**
* {@inheritdoc}
*/
public function getExpectedVersion()
{
return '2.6';
}
/**
* {@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 => 'set',
13 => 'setnx',
14 => 'mset',
15 => 'msetnx',
16 => 'get',
17 => 'mget',
18 => 'getset',
19 => 'incr',
20 => 'incrby',
21 => 'decr',
22 => 'decrby',
23 => 'rpush',
24 => 'lpush',
25 => 'llen',
26 => 'lrange',
27 => 'ltrim',
28 => 'lindex',
29 => 'lset',
30 => 'lrem',
31 => 'lpop',
32 => 'rpop',
33 => 'rpoplpush',
34 => 'sadd',
35 => 'srem',
36 => 'spop',
37 => 'smove',
38 => 'scard',
39 => 'sismember',
40 => 'sinter',
41 => 'sinterstore',
42 => 'sunion',
43 => 'sunionstore',
44 => 'sdiff',
45 => 'sdiffstore',
46 => 'smembers',
47 => 'srandmember',
48 => 'zadd',
49 => 'zincrby',
50 => 'zrem',
51 => 'zrange',
52 => 'zrevrange',
53 => 'zrangebyscore',
54 => 'zcard',
55 => 'zscore',
56 => 'zremrangebyscore',
57 => 'ping',
58 => 'auth',
59 => 'select',
60 => 'echo',
61 => 'quit',
62 => 'info',
63 => 'slaveof',
64 => 'monitor',
65 => 'dbsize',
66 => 'flushdb',
67 => 'flushall',
68 => 'save',
69 => 'bgsave',
70 => 'lastsave',
71 => 'shutdown',
72 => 'bgrewriteaof',
73 => 'setex',
74 => 'append',
75 => 'substr',
76 => 'blpop',
77 => 'brpop',
78 => 'zunionstore',
79 => 'zinterstore',
80 => 'zcount',
81 => 'zrank',
82 => 'zrevrank',
83 => 'zremrangebyrank',
84 => 'hset',
85 => 'hsetnx',
86 => 'hmset',
87 => 'hincrby',
88 => 'hget',
89 => 'hmget',
90 => 'hdel',
91 => 'hexists',
92 => 'hlen',
93 => 'hkeys',
94 => 'hvals',
95 => 'hgetall',
96 => 'multi',
97 => 'exec',
98 => 'discard',
99 => 'subscribe',
100 => 'unsubscribe',
101 => 'psubscribe',
102 => 'punsubscribe',
103 => 'publish',
104 => 'config',
105 => 'persist',
106 => 'strlen',
107 => 'setrange',
108 => 'getrange',
109 => 'setbit',
110 => 'getbit',
111 => 'rpushx',
112 => 'lpushx',
113 => 'linsert',
114 => 'brpoplpush',
115 => 'zrevrangebyscore',
116 => 'watch',
117 => 'unwatch',
118 => 'object',
119 => 'slowlog',
120 => 'client',
121 => 'pttl',
122 => 'pexpire',
123 => 'pexpireat',
124 => 'psetex',
125 => 'incrbyfloat',
126 => 'hincrbyfloat',
127 => 'eval',
128 => 'evalsha',
129 => 'script',
130 => 'time',
);
}
}
@@ -29,7 +29,7 @@ class ServerVersionNextTest extends ServerVersionTestCase
*/
public function getExpectedVersion()
{
return '2.6';
return '3.0';
}
/**