Skip to content

Commit 5da3ed1

Browse files
moparisthebestnerzhul
authored andcommittedFeb 6, 2017
Add support for unix socket connection to redis (#5179)
1 parent 3e30731 commit 5da3ed1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

Diff for: ‎src/database-redis.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Database_Redis::Database_Redis(Settings &conf)
4444
}
4545
const char *addr = tmp.c_str();
4646
int port = conf.exists("redis_port") ? conf.getU16("redis_port") : 6379;
47-
ctx = redisConnect(addr, port);
47+
// if redis_address contains '/' assume unix socket, else hostname/ip
48+
ctx = tmp.find('/') != std::string::npos ? redisConnectUnix(addr) : redisConnect(addr, port);
4849
if (!ctx) {
4950
throw DatabaseException("Cannot allocate redis context");
5051
} else if (ctx->err) {

0 commit comments

Comments
 (0)
Please sign in to comment.