Skip to content
Merged

v171 #57

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## CHANGELOG

### v1.7.1 (2017-08-19)
- Fixed bug of ClientFactory with default client version

### v1.7.0 (2017-07-22)
- The client was checked with Redis-4.0.0
- The client uses last stable redis version (Redis-4.0.0) by default.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Latest Stable Version](https://poser.pugx.org/cheprasov/php-redis-client/v/stable)](https://packagist.org/packages/cheprasov/php-redis-client)
[![Total Downloads](https://poser.pugx.org/cheprasov/php-redis-client/downloads)](https://packagist.org/packages/cheprasov/php-redis-client)
# RedisClient v1.7.0 for PHP >= 5.5
# RedisClient v1.7.1 for PHP >= 5.5

## About
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__
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cheprasov/php-redis-client",
"version": "1.7.0",
"version": "1.7.1",
"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",
"homepage": "http://github.com/cheprasov/php-redis-client",
"minimum-stability": "stable",
Expand Down
2 changes: 1 addition & 1 deletion src/RedisClient/Client/AbstractRedisClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

abstract class AbstractRedisClient {

const VERSION = '1.7.0';
const VERSION = '1.7.1';

const CONFIG_SERVER = 'server';
const CONFIG_TIMEOUT = 'timeout';
Expand Down
9 changes: 8 additions & 1 deletion src/RedisClient/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ public static function getDefaultRedisVersion() {
* @param string $version
* @throws InvalidArgumentException
* @throws ErrorException
* @return bool
*/
public static function setDefaultRedisVersion($version) {
if (self::$defaultRedisVersion == $version) {
return true;
}
if (class_exists('\RedisClient\RedisClient', false)) {
throw new ErrorException('You can setup default version only if class "\RedisClient\RedisClient" is not loaded.');
}
Expand All @@ -68,6 +72,7 @@ public static function setDefaultRedisVersion($version) {
);
}
self::$defaultRedisVersion = $version;
return true;
}

/**
Expand Down Expand Up @@ -96,7 +101,9 @@ public static function createClientByVersion($version, $config = null) {
if ($v >= $ver) {
$class = self::$versions[$v];
if (!self::$defaultRedisVersion) {
self::setDefaultRedisVersion($v);
if (self::setDefaultRedisVersion($v)) {
return new RedisClient($config);
}
}
break;
}
Expand Down