diff --git a/redis/vibe/db/redis/redis.d b/redis/vibe/db/redis/redis.d index 7c34ae789..177091e21 100644 --- a/redis/vibe/db/redis/redis.d +++ b/redis/vibe/db/redis/redis.d @@ -33,6 +33,7 @@ import std.utf; */ RedisClient connectRedis(string host, ushort port = RedisClient.defaultPort) { + assert(!host.startsWith("redis://")); return new RedisClient(host, port); } @@ -89,6 +90,17 @@ RedisDatabase connectRedisDB(URL url) return cli.getDatabase(databaseIndex); } +/// ditto +RedisDatabase connectRedisDB(string host_or_url) +{ + /* If this looks like a URL try to parse it that way. */ + if(host_or_url.startsWith("redis://")){ + return connectRedisDB(URL(host_or_url)); + } else { + return connectRedis(host_or_url).getDatabase(0); + } +} + /** A redis client with connection pooling. */