Skip to content

Commit b02fb20

Browse files
authored
Merge pull request #57 from cheprasov/v171
v171
2 parents 6712363 + 40c4bb5 commit b02fb20

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## CHANGELOG
22

3+
### v1.7.1 (2017-08-19)
4+
- Fixed bug of ClientFactory with default client version
5+
36
### v1.7.0 (2017-07-22)
47
- The client was checked with Redis-4.0.0
58
- The client uses last stable redis version (Redis-4.0.0) by default.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
22
[![Latest Stable Version](https://poser.pugx.org/cheprasov/php-redis-client/v/stable)](https://packagist.org/packages/cheprasov/php-redis-client)
33
[![Total Downloads](https://poser.pugx.org/cheprasov/php-redis-client/downloads)](https://packagist.org/packages/cheprasov/php-redis-client)
4-
# RedisClient v1.7.0 for PHP >= 5.5
4+
# RedisClient v1.7.1 for PHP >= 5.5
55

66
## About
77
RedisClient is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from __2.6__ to __4.0__

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cheprasov/php-redis-client",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 4.0",
55
"homepage": "http://github.com/cheprasov/php-redis-client",
66
"minimum-stability": "stable",

src/RedisClient/Client/AbstractRedisClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
abstract class AbstractRedisClient {
2828

29-
const VERSION = '1.7.0';
29+
const VERSION = '1.7.1';
3030

3131
const CONFIG_SERVER = 'server';
3232
const CONFIG_TIMEOUT = 'timeout';

src/RedisClient/ClientFactory.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ public static function getDefaultRedisVersion() {
5454
* @param string $version
5555
* @throws InvalidArgumentException
5656
* @throws ErrorException
57+
* @return bool
5758
*/
5859
public static function setDefaultRedisVersion($version) {
60+
if (self::$defaultRedisVersion == $version) {
61+
return true;
62+
}
5963
if (class_exists('\RedisClient\RedisClient', false)) {
6064
throw new ErrorException('You can setup default version only if class "\RedisClient\RedisClient" is not loaded.');
6165
}
@@ -68,6 +72,7 @@ public static function setDefaultRedisVersion($version) {
6872
);
6973
}
7074
self::$defaultRedisVersion = $version;
75+
return true;
7176
}
7277

7378
/**
@@ -96,7 +101,9 @@ public static function createClientByVersion($version, $config = null) {
96101
if ($v >= $ver) {
97102
$class = self::$versions[$v];
98103
if (!self::$defaultRedisVersion) {
99-
self::setDefaultRedisVersion($v);
104+
if (self::setDefaultRedisVersion($v)) {
105+
return new RedisClient($config);
106+
}
100107
}
101108
break;
102109
}

0 commit comments

Comments
 (0)