Skip to main content

PooledRedisClientManager

Provides thread-safe pooling of redis client connections. Allows load-balancing of master-write and read-replica hosts, ideal for 1 master and multiple replicated read replicas.

Assembly: ServiceStack.Redis.dll
View Source
Declaration
public class PooledRedisClientManager : IRedisClientsManagerAsync, IRedisClientsManager, IRedisFailover, IHandleClientDispose, IHasRedisResolver, IHasStats, IRedisClientCacheManager, IDisposable

Properties

PoolTimeout

View Source
Declaration
public int? PoolTimeout { get; set; }

ConnectTimeout

View Source
Declaration
public int? ConnectTimeout { get; set; }

SocketSendTimeout

View Source
Declaration
public int? SocketSendTimeout { get; set; }

SocketReceiveTimeout

View Source
Declaration
public int? SocketReceiveTimeout { get; set; }

IdleTimeOutSecs

View Source
Declaration
public int? IdleTimeOutSecs { get; set; }

AssertAccessOnlyOnSameThread

View Source
Declaration
public bool AssertAccessOnlyOnSameThread { get; set; }

NamespacePrefix

Gets or sets object key prefix.

View Source
Declaration
public string NamespacePrefix { get; set; }

RedisResolver

View Source
Declaration
public IRedisResolver RedisResolver { get; set; }

OnFailover

View Source
Declaration
public List<Action<IRedisClientsManager>> OnFailover { get; }

Config

View Source
Declaration
protected RedisClientManagerConfig Config { get; set; }

Db

View Source
Declaration
public long? Db { get; }

ConnectionFilter

View Source
Declaration
public Action<IRedisNativeClient> ConnectionFilter { get; set; }

Stats

View Source
Declaration
public Dictionary<string, long> Stats { get; }

Fields

UseGetClientBlocking

Use previous client resolving behavior

View Source
Declaration
public static bool UseGetClientBlocking

PoolSizeMultiplier

View Source
Declaration
protected readonly int PoolSizeMultiplier

RecheckPoolAfterMs

View Source
Declaration
public int RecheckPoolAfterMs

WritePoolIndex

View Source
Declaration
protected int WritePoolIndex

ReadPoolIndex

View Source
Declaration
protected int ReadPoolIndex

RedisClientCounter

View Source
Declaration
protected int RedisClientCounter

Methods

FailoverTo(String[])

View Source
Declaration
public void FailoverTo(params string[] readWriteHosts)
Parameters
TypeName
System.String[]readWriteHosts

FailoverTo(IEnumerable<String>, IEnumerable<String>)

View Source
Declaration
public void FailoverTo(IEnumerable<string> readWriteHosts, IEnumerable<string> readOnlyHosts)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>readWriteHosts
System.Collections.Generic.IEnumerable<System.String>readOnlyHosts

OnStart()

View Source
Declaration
protected virtual void OnStart()

GetClient()

Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts

View Source
Declaration
public IRedisClient GetClient()
Returns

ServiceStack.Redis.IRedisClient

GetReadOnlyClient()

Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.

View Source
Declaration
public virtual IRedisClient GetReadOnlyClient()
Returns

ServiceStack.Redis.IRedisClient

DisposeClient(RedisNativeClient)

View Source
Declaration
public void DisposeClient(RedisNativeClient client)
Parameters
TypeName
ServiceStack.Redis.RedisNativeClientclient

DisposeReadOnlyClient(RedisNativeClient)

Disposes the read only client.

View Source
Declaration
public void DisposeReadOnlyClient(RedisNativeClient client)
Parameters
TypeNameDescription
ServiceStack.Redis.RedisNativeClientclientThe client.

|

DisposeWriteClient(RedisNativeClient)

Disposes the write client.

View Source
Declaration
public void DisposeWriteClient(RedisNativeClient client)
Parameters
TypeNameDescription
ServiceStack.Redis.RedisNativeClientclientThe client.

|

Start()

View Source
Declaration
public void Start()

GetStats()

View Source
Declaration
public Dictionary<string, string> GetStats()
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

GetClientPoolActiveStates()

View Source
Declaration
public int[] GetClientPoolActiveStates()
Returns

System.Int32[]

GetReadOnlyClientPoolActiveStates()

View Source
Declaration
public int[] GetReadOnlyClientPoolActiveStates()
Returns

System.Int32[]

Finalize()

View Source
Declaration
protected void Finalize()

Dispose()

View Source
Declaration
public void Dispose()

Dispose(Boolean)

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeName
System.Booleandisposing

Dispose(RedisClient)

View Source
Declaration
protected void Dispose(RedisClient redisClient)
Parameters
TypeName
ServiceStack.Redis.RedisClientredisClient

GetCacheClient()

View Source
Declaration
public ICacheClient GetCacheClient()
Returns

ServiceStack.Caching.ICacheClient

GetReadOnlyCacheClient()

View Source
Declaration
public ICacheClient GetReadOnlyCacheClient()
Returns

ServiceStack.Caching.ICacheClient

GetDisposableClient<T>()

View Source
Declaration
public PooledRedisClientManager.DisposablePooledClient<T> GetDisposableClient<T>()
where T : RedisNativeClient
Returns

ServiceStack.Redis.PooledRedisClientManager.DisposablePooledClient<T>

Type Parameters
  • T

Implements