Skip to content

Commit

Permalink
Two specific methods for client disposal, they avoid having to needle…
Browse files Browse the repository at this point in the history
…ssly loop over a every single clients in the pool.
  • Loading branch information
cbarbara committed May 10, 2012
1 parent e8369be commit 7b75efa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/ServiceStack.Redis/PooledRedisClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,32 @@ public void DisposeClient(RedisNativeClient client)
if (client.IsDisposed) return;

throw new NotSupportedException("Cannot add unknown client back to the pool");
}

/// <summary>
/// Disposes the read only client.
/// </summary>
/// <param name="client">The client.</param>
public void DisposeReadOnlyClient( RedisNativeClient client )
{
lock( readClients )
{
client.Active = false;
Monitor.PulseAll( readClients );
}
}

/// <summary>
/// Disposes the write client.
/// </summary>
/// <param name="client">The client.</param>
public void DisposeWriteClient( RedisNativeClient client )
{
lock( writeClients )
{
client.Active = false;
Monitor.PulseAll( writeClients );
}
}

public void Start()
Expand Down

0 comments on commit 7b75efa

Please sign in to comment.