Commit 4d94274f authored by Chad Gilbert's avatar Chad Gilbert

Now uses defaultDatabase without modifying the GetDatabase() signature

parent c7be3110
...@@ -897,12 +897,14 @@ public ISubscriber GetSubscriber(object asyncState = null) ...@@ -897,12 +897,14 @@ public ISubscriber GetSubscriber(object asyncState = null)
/// <summary> /// <summary>
/// Obtain an interactive connection to a database inside redis /// Obtain an interactive connection to a database inside redis
/// </summary> /// </summary>
public IDatabase GetDatabase(int? db = null, object asyncState = null) public IDatabase GetDatabase(int db = -1, object asyncState = null)
{ {
int dbId = db ?? configuration.DefaultDatabase ?? 0; if (db == -1)
if (dbId < 0) throw new ArgumentOutOfRangeException("db"); db = configuration.DefaultDatabase ?? 0;
if (dbId != 0 && RawConfig.Proxy == Proxy.Twemproxy) throw new NotSupportedException("Twemproxy only supports database 0");
return new RedisDatabase(this, dbId, asyncState); if (db < 0) throw new ArgumentOutOfRangeException("db");
if (db != 0 && RawConfig.Proxy == Proxy.Twemproxy) throw new NotSupportedException("Twemproxy only supports database 0");
return new RedisDatabase(this, db, asyncState);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment