浏览代码

Rename Predis\IConnectionSchemes to Predis\IConnectionFactory.

Daniele Alessandri 14 年之前
父节点
当前提交
b22cb6f76d

+ 1 - 1
FAQ.PERFORMANCES.markdown

@@ -55,7 +55,7 @@ name) and let Predis using it. __phpiredis__ is a C-based extension that wraps _
 official Redis C client library) with a thin layer that exposes its features to PHP. You will now
 official Redis C client library) with a thin layer that exposes its features to PHP. You will now
 get the benefits of a faster protocol parser just by adding a single line of code in your application:
 get the benefits of a faster protocol parser just by adding a single line of code in your application:
 
 
-    Predis\Client::defineConnection('tcp', '\Predis\Network\PhpiredisConnection');
+    Predis\ConnectionFactory::define('tcp', '\Predis\Network\PhpiredisConnection');
 
 
 As simple as it is, nothing will really change in the way you use the library in your application. So,
 As simple as it is, nothing will really change in the way you use the library in your application. So,
 how fast is it now? There are not much improvements for inline or short bulk replies (e.g. _SET_ or
 how fast is it now? There are not much improvements for inline or short bulk replies (e.g. _SET_ or

+ 5 - 5
lib/Predis/Client.php

@@ -11,13 +11,13 @@ use Predis\Profiles\IServerProfile;
 
 
 class Client {
 class Client {
     const VERSION = '0.7.0-dev';
     const VERSION = '0.7.0-dev';
-    private $_options, $_schemes, $_profile, $_connection;
+    private $_options, $_connectionFactory, $_profile, $_connection;
 
 
     public function __construct($parameters = null, $options = null) {
     public function __construct($parameters = null, $options = null) {
         $options = $this->filterOptions($options ?: new ClientOptions());
         $options = $this->filterOptions($options ?: new ClientOptions());
         $this->_options = $options;
         $this->_options = $options;
         $this->_profile = $options->profile;
         $this->_profile = $options->profile;
-        $this->_schemes = $options->connections;
+        $this->_connectionFactory = $options->connections;
         $this->_connection = $this->initializeConnection($parameters);
         $this->_connection = $this->initializeConnection($parameters);
     }
     }
 
 
@@ -60,7 +60,7 @@ class Client {
     }
     }
 
 
     private function createConnection($parameters) {
     private function createConnection($parameters) {
-        $connection = $this->_schemes->newConnection($parameters);
+        $connection = $this->_connectionFactory->newConnection($parameters);
         $this->pushInitCommands($connection);
         $this->pushInitCommands($connection);
         return $connection;
         return $connection;
     }
     }
@@ -87,8 +87,8 @@ class Client {
         return $this->_options;
         return $this->_options;
     }
     }
 
 
-    public function getSchemes() {
-        return $this->_schemes;
+    public function getConnectionFactory() {
+        return $this->_connectionFactory;
     }
     }
 
 
     public function getClientFor($connectionAlias) {
     public function getClientFor($connectionAlias) {

+ 3 - 3
lib/Predis/ClientOptions.php

@@ -24,14 +24,14 @@ class ClientOptions {
             'key_distribution' => new ClientKeyDistribution(),
             'key_distribution' => new ClientKeyDistribution(),
             'connections' => new CustomOption(array(
             'connections' => new CustomOption(array(
                 'default'  => function() {
                 'default'  => function() {
-                    return new ConnectionSchemes();
+                    return new ConnectionFactory();
                 },
                 },
                 'validate' => function($value) {
                 'validate' => function($value) {
-                    if ($value instanceof IConnectionSchemes) {
+                    if ($value instanceof IConnectionFactory) {
                         return $value;
                         return $value;
                     }
                     }
                     if (is_array($value)) {
                     if (is_array($value)) {
-                        return new ConnectionSchemes($value);
+                        return new ConnectionFactory($value);
                     }
                     }
                 },
                 },
             )),
             )),

+ 1 - 1
lib/Predis/ConnectionSchemes.php → lib/Predis/ConnectionFactory.php

@@ -2,7 +2,7 @@
 
 
 namespace Predis;
 namespace Predis;
 
 
-class ConnectionSchemes implements IConnectionSchemes {
+class ConnectionFactory implements IConnectionFactory {
     private static $_globalSchemes;
     private static $_globalSchemes;
     private $_instanceSchemes = array();
     private $_instanceSchemes = array();
 
 

+ 1 - 1
lib/Predis/IConnectionSchemes.php → lib/Predis/IConnectionFactory.php

@@ -2,6 +2,6 @@
 
 
 namespace Predis;
 namespace Predis;
 
 
-interface IConnectionSchemes {
+interface IConnectionFactory {
     public function newConnection($parameters);
     public function newConnection($parameters);
 }
 }