Skip to content
Open
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
2 changes: 2 additions & 0 deletions library/Rediska.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ public function addServer($host, $port = Rediska_Connection::DEFAULT_PORT, array
if (isset($options['useSocket'])) {
if ($options['useSocket'] == true) {
$connectionClass = static::CONNECTION_SOCKET_CLASS;
} else {
$connectionClass = static::CONNECTION_CLASS;
}
unset($options['useSocket']);
} else {
Expand Down
7 changes: 6 additions & 1 deletion library/Rediska/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Rediska_Connection extends Rediska_Options
public function connect()
{
if (!$this->isConnected()) {
$socketAddress = 'tcp://' . $this->getHost() . ':' . $this->getPort();
$socketAddress = $this->getSocketAddress();

if ($this->_options['persistent']) {
$flag = STREAM_CLIENT_PERSISTENT | STREAM_CLIENT_CONNECT;
Expand Down Expand Up @@ -136,6 +136,11 @@ public function connect()
}
}

public function getSocketAddress()
{
return 'tcp://' . $this->getHost() . ':' . $this->getPort();
}

/**
* Disconnect
*
Expand Down
22 changes: 22 additions & 0 deletions library/Rediska/Connection/UnixSocket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Rediska unix socket connection
*
* @author Ivan Shumkov
* @package Rediska
* @subpackage Connection
* @version 0.5.10
* @link http://rediska.geometria-lab.net
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class Rediska_Connection_UnixSocket extends Rediska_Connection
{
/**
* @return string
*/
public function getSocketAddress()
{
return 'unix://' . $this->getHost();
}
}