Skip to content

Commit

Permalink
Merge pull request #502 from fabsi88/master
Browse files Browse the repository at this point in the history
Adding convenience method to parse Redis version
  • Loading branch information
s-ludwig committed Feb 7, 2014
2 parents eb99eb0 + eddcbda commit 8fca763
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/vibe/db/redis/redis.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,24 @@ final class RedisClient {
ConnectionPool!RedisConnection m_connections;
string m_authPassword;
size_t m_selectedDB;
string m_version;
}

this(string host = "127.0.0.1", ushort port = 6379)
{
m_connections = new ConnectionPool!RedisConnection({
return new RedisConnection(host, port);
});

import std.string;
auto info = info();
auto lines = info.splitLines();
if (lines.length > 1) {
auto lineParams = lines[1].split(":");
if (lineParams.length > 1 && lineParams[0] == "redis_version") {
m_version = lineParams[1];
}
}
}

size_t del(string[] keys...) { return request!size_t("DEL", keys); }
Expand Down Expand Up @@ -246,6 +257,10 @@ final class RedisClient {
//TODO slowlog
//TODO sync

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

T request(T = RedisReply, ARGS...)(string command, ARGS args)
{
Expand Down

0 comments on commit 8fca763

Please sign in to comment.