Skip to main content

BasicRedisClientManager

Provides thread-safe retrieval of redis clients since each client is a new one. Allows the configuration of different ReadWrite and ReadOnly hosts

Assembly: ServiceStack.Redis.dll
View Source
Declaration
public class BasicRedisClientManager : IRedisClientsManagerAsync, ICacheClientAsync, IRedisClientsManager, IRedisFailover, IHasRedisResolver, IHasStats, ICacheClient, IDisposable

Properties

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; }

NamespacePrefix

Gets or sets object key prefix.

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

ClientFactory

View Source
Declaration
public Func<RedisEndpoint, RedisClient> ClientFactory { get; set; }

Db

View Source
Declaration
public long? Db { get; }

ConnectionFilter

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

OnFailover

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

RedisResolver

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

Stats

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

Fields

Log

View Source
Declaration
public static ILog Log

RedisClientCounter

View Source
Declaration
protected int RedisClientCounter

Methods

ICacheClientAsync.GetAsync<T>(String, CancellationToken)

View Source
Declaration
async Task<T> ICacheClientAsync.GetAsync<T>(string key, CancellationToken token)
Returns

System.Threading.Tasks.Task<<T>>

Parameters
TypeName
System.Stringkey
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.SetAsync<T>(String, T, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.SetAsync<T>(String, T, DateTime, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.SetAsync<T>(String, T, TimeSpan, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.FlushAllAsync(CancellationToken)

View Source
Declaration
async Task ICacheClientAsync.FlushAllAsync(CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Threading.CancellationTokentoken

ICacheClientAsync.GetAllAsync<T>(IEnumerable<String>, CancellationToken)

View Source
Declaration
async Task<IDictionary<string, T>> ICacheClientAsync.GetAllAsync<T>(IEnumerable<string> keys, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String,<T>>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.SetAllAsync<T>(IDictionary<String, T>, CancellationToken)

View Source
Declaration
async Task ICacheClientAsync.SetAllAsync<T>(IDictionary<string, T> values, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Collections.Generic.IDictionary<System.String,<T>>values
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.RemoveAsync(String, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.RemoveAsync(string key, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
System.Threading.CancellationTokentoken

ICacheClientAsync.RemoveAllAsync(IEnumerable<String>, CancellationToken)

View Source
Declaration
async Task ICacheClientAsync.RemoveAllAsync(IEnumerable<string> keys, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys
System.Threading.CancellationTokentoken

ICacheClientAsync.IncrementAsync(String, UInt32, CancellationToken)

View Source
Declaration
async Task<long> ICacheClientAsync.IncrementAsync(string key, uint amount, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Int64>

Parameters
TypeName
System.Stringkey
System.UInt32amount
System.Threading.CancellationTokentoken

ICacheClientAsync.DecrementAsync(String, UInt32, CancellationToken)

View Source
Declaration
async Task<long> ICacheClientAsync.DecrementAsync(string key, uint amount, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Int64>

Parameters
TypeName
System.Stringkey
System.UInt32amount
System.Threading.CancellationTokentoken

ICacheClientAsync.AddAsync<T>(String, T, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.ReplaceAsync<T>(String, T, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.AddAsync<T>(String, T, DateTime, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.ReplaceAsync<T>(String, T, DateTime, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.AddAsync<T>(String, T, TimeSpan, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.ReplaceAsync<T>(String, T, TimeSpan, CancellationToken)

View Source
Declaration
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
System.Threading.CancellationTokentoken
Type Parameters
  • T

ICacheClientAsync.GetTimeToLiveAsync(String, CancellationToken)

View Source
Declaration
async Task<TimeSpan?> ICacheClientAsync.GetTimeToLiveAsync(string key, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Nullable<System.TimeSpan>>

Parameters
TypeName
System.Stringkey
System.Threading.CancellationTokentoken

ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken)

View Source
Declaration
async Task ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Threading.CancellationTokentoken

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

SetAll<T>(IDictionary<String, T>)

View Source
Declaration
public void SetAll<T>(IDictionary<string, T> values)
Parameters
TypeName
System.Collections.Generic.IDictionary<System.String,<T>>values
Type Parameters
  • T

Start()

View Source
Declaration
public void Start()

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

Dispose()

View Source
Declaration
public void Dispose()

GetCacheClient()

View Source
Declaration
public ICacheClient GetCacheClient()
Returns

ServiceStack.Caching.ICacheClient

GetReadOnlyCacheClient()

View Source
Declaration
public ICacheClient GetReadOnlyCacheClient()
Returns

ServiceStack.Caching.ICacheClient

Remove(String)

View Source
Declaration
public bool Remove(string key)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey

RemoveAll(IEnumerable<String>)

View Source
Declaration
public void RemoveAll(IEnumerable<string> keys)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys

Get<T>(String)

View Source
Declaration
public T Get<T>(string key)
Returns

<T>

Parameters
TypeName
System.Stringkey
Type Parameters
  • T

Increment(String, UInt32)

View Source
Declaration
public long Increment(string key, uint amount)
Returns

System.Int64

Parameters
TypeName
System.Stringkey
System.UInt32amount

Decrement(String, UInt32)

View Source
Declaration
public long Decrement(string key, uint amount)
Returns

System.Int64

Parameters
TypeName
System.Stringkey
System.UInt32amount

Add<T>(String, T)

View Source
Declaration
public bool Add<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
Type Parameters
  • T

Set<T>(String, T)

View Source
Declaration
public bool Set<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
Type Parameters
  • T

Replace<T>(String, T)

View Source
Declaration
public bool Replace<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
Type Parameters
  • T

Add<T>(String, T, DateTime)

View Source
Declaration
public bool Add<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
Type Parameters
  • T

Set<T>(String, T, DateTime)

View Source
Declaration
public bool Set<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
Type Parameters
  • T

Replace<T>(String, T, DateTime)

View Source
Declaration
public bool Replace<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
Type Parameters
  • T

Add<T>(String, T, TimeSpan)

View Source
Declaration
public bool Add<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
Type Parameters
  • T

Set<T>(String, T, TimeSpan)

View Source
Declaration
public bool Set<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
Type Parameters
  • T

Replace<T>(String, T, TimeSpan)

View Source
Declaration
public bool Replace<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
Type Parameters
  • T

FlushAll()

View Source
Declaration
public void FlushAll()

GetAll<T>(IEnumerable<String>)

View Source
Declaration
public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
Returns

System.Collections.Generic.IDictionary<System.String,<T>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys
Type Parameters
  • T

Implements