Skip to content

Commit

Permalink
Merge pull request #785 from yamadapc/master
Browse files Browse the repository at this point in the history
Fix `RedisClient` instantiation for authentication
  • Loading branch information
s-ludwig committed Aug 21, 2014
2 parents 607f7cf + 2ba8b74 commit d1dd6c9
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions source/vibe/db/redis/redis.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ RedisClient connectRedis(string host, ushort port = 6379)
return new RedisClient(host, port);
}


/**
A redis client with connection pooling.
*/
Expand All @@ -47,23 +46,29 @@ final class RedisClient {
m_connections = new ConnectionPool!RedisConnection({
return new RedisConnection(host, port);
});
}

import std.string;
auto info = info();
auto lines = info.splitLines();
if (lines.length > 1) {
foreach (string line; lines) {
auto lineParams = line.split(":");
if (lineParams.length > 1 && lineParams[0] == "redis_version") {
m_version = lineParams[1];
break;
/// Returns Redis version
@property string redisVersion()
{
if(!m_version)
{
import std.string;
auto info = info();
auto lines = info.splitLines();
if (lines.length > 1) {
foreach (string line; lines) {
auto lineParams = line.split(":");
if (lineParams.length > 1 && lineParams[0] == "redis_version") {
m_version = lineParams[1];
break;
}
}
}
}
}
}

/// Returns Redis version
@property string redisVersion() { return m_version; }
return m_version;
}

/** Returns a handle to the given database.
*/
Expand Down

0 comments on commit d1dd6c9

Please sign in to comment.