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
public class BasicRedisClientManager : IRedisClientsManagerAsync, ICacheClientAsync, IRedisClientsManager, IRedisFailover, IHasRedisResolver, IHasStats, ICacheClient, IDisposable
Properties
ConnectTimeout
View Source
public int? ConnectTimeout { get; set; }
SocketSendTimeout
View Source
public int? SocketSendTimeout { get; set; }
SocketReceiveTimeout
View Source
public int? SocketReceiveTimeout { get; set; }
IdleTimeOutSecs
View Source
public int? IdleTimeOutSecs { get; set; }
NamespacePrefix
Gets or sets object key prefix.
View Source
public string NamespacePrefix { get; set; }
ClientFactory
View Source
public Func<RedisEndpoint, RedisClient> ClientFactory { get; set; }
Db
View Source
public long? Db { get; }
ConnectionFilter
View Source
public Action<IRedisNativeClient> ConnectionFilter { get; set; }
OnFailover
View Source
public List<Action<IRedisClientsManager>> OnFailover { get; }
RedisResolver
View Source
public IRedisResolver RedisResolver { get; set; }
Stats
View Source
public Dictionary<string, long> Stats { get; }
Fields
Log
View Source
public static ILog Log
RedisClientCounter
View Source
protected int RedisClientCounter
Methods
ICacheClientAsync.GetAsync<T>(String, CancellationToken)
View Source
async Task<T> ICacheClientAsync.GetAsync<T>(string key, CancellationToken token)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
System.String | key |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.SetAsync<T>(String, T, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.SetAsync<T>(String, T, DateTime, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.SetAsync<T>(String, T, TimeSpan, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.SetAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.FlushAllAsync(CancellationToken)
View Source
async Task ICacheClientAsync.FlushAllAsync(CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.CancellationToken | token |
ICacheClientAsync.GetAllAsync<T>(IEnumerable<String>, CancellationToken)
View Source
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
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.SetAllAsync<T>(IDictionary<String, T>, CancellationToken)
View Source
async Task ICacheClientAsync.SetAllAsync<T>(IDictionary<string, T> values, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Collections.Generic.IDictionary<System.String,<T>> | values |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.RemoveAsync(String, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.RemoveAsync(string key, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
System.Threading.CancellationToken | token |
ICacheClientAsync.RemoveAllAsync(IEnumerable<String>, CancellationToken)
View Source
async Task ICacheClientAsync.RemoveAllAsync(IEnumerable<string> keys, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
System.Threading.CancellationToken | token |
ICacheClientAsync.IncrementAsync(String, UInt32, CancellationToken)
View Source
async Task<long> ICacheClientAsync.IncrementAsync(string key, uint amount, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Int64>
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
System.Threading.CancellationToken | token |
ICacheClientAsync.DecrementAsync(String, UInt32, CancellationToken)
View Source
async Task<long> ICacheClientAsync.DecrementAsync(string key, uint amount, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Int64>
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
System.Threading.CancellationToken | token |
ICacheClientAsync.AddAsync<T>(String, T, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.ReplaceAsync<T>(String, T, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.AddAsync<T>(String, T, DateTime, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.ReplaceAsync<T>(String, T, DateTime, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, DateTime expiresAt, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.AddAsync<T>(String, T, TimeSpan, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.AddAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.ReplaceAsync<T>(String, T, TimeSpan, CancellationToken)
View Source
async Task<bool> ICacheClientAsync.ReplaceAsync<T>(string key, T value, TimeSpan expiresIn, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
System.Threading.CancellationToken | token |
Type Parameters
T
ICacheClientAsync.GetTimeToLiveAsync(String, CancellationToken)
View Source
async Task<TimeSpan?> ICacheClientAsync.GetTimeToLiveAsync(string key, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Nullable<System.TimeSpan>>
Parameters
Type | Name |
---|---|
System.String | key |
System.Threading.CancellationToken | token |
ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken)
View Source
async Task ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.CancellationToken | token |
OnStart()
View Source
protected virtual void OnStart()
GetClient()
Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts
View Source
public IRedisClient GetClient()
Returns
ServiceStack.Redis.IRedisClient
GetReadOnlyClient()
Returns a ReadOnly client using the hosts defined in ReadOnlyHosts.
View Source
public virtual IRedisClient GetReadOnlyClient()
Returns
ServiceStack.Redis.IRedisClient
SetAll<T>(IDictionary<String, T>)
View Source
public void SetAll<T>(IDictionary<string, T> values)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IDictionary<System.String,<T>> | values |
Type Parameters
T
Start()
View Source
public void Start()
FailoverTo(String[])
View Source
public void FailoverTo(params string[] readWriteHosts)
Parameters
Type | Name |
---|---|
System.String[] | readWriteHosts |
FailoverTo(IEnumerable<String>, IEnumerable<String>)
View Source
public void FailoverTo(IEnumerable<string> readWriteHosts, IEnumerable<string> readOnlyHosts)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | readWriteHosts |
System.Collections.Generic.IEnumerable<System.String> | readOnlyHosts |
Dispose()
View Source
public void Dispose()
GetCacheClient()
View Source
public ICacheClient GetCacheClient()
Returns
ServiceStack.Caching.ICacheClient
GetReadOnlyCacheClient()
View Source
public ICacheClient GetReadOnlyCacheClient()
Returns
ServiceStack.Caching.ICacheClient
Remove(String)
View Source
public bool Remove(string key)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
RemoveAll(IEnumerable<String>)
View Source
public void RemoveAll(IEnumerable<string> keys)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
Get<T>(String)
View Source
public T Get<T>(string key)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | key |
Type Parameters
T
Increment(String, UInt32)
View Source
public long Increment(string key, uint amount)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
Decrement(String, UInt32)
View Source
public long Decrement(string key, uint amount)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
Add<T>(String, T)
View Source
public bool Add<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Set<T>(String, T)
View Source
public bool Set<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Replace<T>(String, T)
View Source
public bool Replace<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Add<T>(String, T, DateTime)
View Source
public bool Add<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Set<T>(String, T, DateTime)
View Source
public bool Set<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Replace<T>(String, T, DateTime)
View Source
public bool Replace<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Add<T>(String, T, TimeSpan)
View Source
public bool Add<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
Set<T>(String, T, TimeSpan)
View Source
public bool Set<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
Replace<T>(String, T, TimeSpan)
View Source
public bool Replace<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
FlushAll()
View Source
public void FlushAll()
GetAll<T>(IEnumerable<String>)
View Source
public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
Returns
System.Collections.Generic.IDictionary<System.String,<T>>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
Type Parameters
T