Skip to content

Commit d774e6b

Browse files
committed
Merge pull request #30 from cheprasov/dev-with-versions
v1.1.0
2 parents 9bbd63f + 0f096c8 commit d774e6b

File tree

9 files changed

+115
-6
lines changed

9 files changed

+115
-6
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cheprasov/php-redis-client",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Php client for Redis",
55
"homepage": "http://github.com/cheprasov/php-redis-client",
66
"minimum-stability": "stable",

src/RedisClient/Client/AbstractRedisClient.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
use RedisClient\Protocol\ProtocolInterface;
1919
use RedisClient\Protocol\RedisProtocol;
2020

21-
2221
abstract class AbstractRedisClient {
2322

24-
const VERSION = '1.0.0';
23+
const VERSION = '1.1.0';
2524

2625
const CONFIG_SERVER = 'server';
2726
const CONFIG_TIMEOUT = 'timeout';

src/RedisClient/Command/Traits/Version2x9/ServerCommandsTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait ServerCommandsTrait {
2121
* Time complexity: O(1)
2222
*
2323
* @param int $timeout
24-
* @return true The command returns True or an error if the timeout is invalid.
24+
* @return bool The command returns True or an error if the timeout is invalid.
2525
*/
2626
public function clientPause($timeout) {
2727
return $this->returnCommand(['CLIENT', 'PAUSE'], [$timeout]);

src/RedisClient/Command/Traits/Version3x2/CommandsTrait.php

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
use RedisClient\Command\Traits\Version2x8\HyperLogLogCommandsTrait;
1919
use RedisClient\Command\Traits\Version3x0\KeysCommandsTrait;
2020
use RedisClient\Command\Traits\Version2x6\ListsCommandsTrait;
21-
use RedisClient\Command\Traits\Version2x6\ScriptingCommandsTrait;
22-
use RedisClient\Command\Traits\Version2x9\ServerCommandsTrait;
2321
use RedisClient\Command\Traits\Version3x0\SortedSetsCommandsTrait;
2422
use RedisClient\Command\Traits\Version2x8\StringsCommandsTrait;
2523
use RedisClient\Command\Traits\Version2x6\TransactionsCommandsTrait;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* This file is part of RedisClient.
4+
* git: https://github.com/cheprasov/php-redis-client
5+
*
6+
* (C) Alexander Cheprasov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
namespace RedisClient\Command\Traits\Version3x2;
12+
13+
use RedisClient\Command\Traits\Version2x6\ScriptingCommandsTrait as ScriptingCommandsTraitVersion2x6;
14+
15+
/**
16+
* trait ScriptingCommandsTrait
17+
* @link http://redis.io/commands#hash
18+
*/
19+
trait ScriptingCommandsTrait {
20+
21+
use ScriptingCommandsTraitVersion2x6;
22+
23+
/**
24+
* SCRIPT DEBUG YES|SYNC|NO
25+
* Available since 3.2.0.
26+
* Time complexity: O(1)
27+
* @link http://redis.io/commands/script-debug
28+
*
29+
* @param string $param YES|SYNC|NO
30+
* @return
31+
*/
32+
public function scriptDebug($param) {
33+
return $this->returnCommand(['SCRIPT', 'DEBUG'], [$param]);
34+
}
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* This file is part of RedisClient.
4+
* git: https://github.com/cheprasov/php-redis-client
5+
*
6+
* (C) Alexander Cheprasov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
namespace RedisClient\Command\Traits\Version3x2;
12+
13+
use RedisClient\Command\Traits\Version2x9\ServerCommandsTrait as ServerCommandsTraitVersion2x9;
14+
trait ServerCommandsTrait {
15+
16+
use ServerCommandsTraitVersion2x9;
17+
18+
/**
19+
* CLIENT REPLY ON|OFF|SKIP
20+
* Available since 3.2.
21+
* Time complexity: O(1)
22+
*
23+
* @param string $param
24+
* @return bool|null
25+
*/
26+
public function clientReply($param) {
27+
return $this->returnCommand(['CLIENT', 'REPLY'], [$param]);
28+
}
29+
30+
}

src/RedisClient/Pipeline/Version/Pipeline3x2.php

+6
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@
282282
* Hashes
283283
* @method Pipeline3x2 hstrlen($key, $field)
284284
*
285+
* Scripting
286+
* @method Pipeline3x2 scriptDebug($param)
287+
*
288+
* Server
289+
* @method Pipeline3x2 clientReply($param)
290+
*
285291
* Sets
286292
* @method Pipeline3x2 spop($key, $count = null)
287293
*

tests/Build/VersionTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* This file is part of RedisClient.
4+
* git: https://github.com/cheprasov/php-redis-client
5+
*
6+
* (C) Alexander Cheprasov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
namespace Test\Build;
12+
13+
use RedisClient\Client\AbstractRedisClient;
14+
15+
class VersionTest extends \PHPUnit_Framework_TestCase {
16+
17+
public function test_version() {
18+
chdir(__DIR__.'/../../');
19+
$composer = json_decode(file_get_contents('./composer.json'), true);
20+
21+
$this->assertSame(true, isset($composer['version']));
22+
$this->assertSame(AbstractRedisClient::VERSION, $composer['version']);
23+
}
24+
25+
}

tests/Integration/Version3x2/ScriptingCommandsTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class ScriptingCommandsTest extends ScriptingCommandsTestVersion3x0 {
2222

2323
const TEST_REDIS_SERVER_1 = TEST_REDIS_SERVER_3x2_1;
2424

25+
/**
26+
* @var RedisClient3x2;
27+
*/
28+
protected static $Redis;
29+
2530
/**
2631
* @inheritdoc
2732
*/
@@ -31,4 +36,14 @@ public static function setUpBeforeClass() {
3136
'timeout' => 2,
3237
]);
3338
}
39+
40+
/**
41+
* @see ScriptingCommandsTrait::scriptDebug
42+
*/
43+
public function test_scriptDebug() {
44+
$Redis = static::$Redis;
45+
$this->assertSame(true, $Redis->scriptDebug('SYNC'));
46+
$this->assertSame(true, $Redis->scriptDebug('YES'));
47+
$this->assertSame(true, $Redis->scriptDebug('NO'));
48+
}
3449
}

0 commit comments

Comments
 (0)