فهرست منبع

Return the path of the file as the identifier for connections based on UNIX domain sockets.

Daniele Alessandri 14 سال پیش
والد
کامیت
9c0012837a
1فایلهای تغییر یافته به همراه8 افزوده شده و 1 حذف شده
  1. 8 1
      lib/Predis/Network/ConnectionBase.php

+ 8 - 1
lib/Predis/Network/ConnectionBase.php

@@ -97,9 +97,16 @@ abstract class ConnectionBase implements IConnectionSingle {
         return $this->_params;
     }
 
+    protected function getIdentifier() {
+        if ($this->_params->scheme === 'unix') {
+            return $this->_params->path;
+        }
+        return "{$this->_params->host}:{$this->_params->port}";
+    }
+
     public function __toString() {
         if (!isset($this->_cachedId)) {
-            $this->_cachedId = "{$this->_params->host}:{$this->_params->port}";
+            $this->_cachedId = $this->getIdentifier();
         }
         return $this->_cachedId;
     }