RedisClientManagerCacheClient
For interoperability GetCacheClient() and GetReadOnlyCacheClient() return an ICacheClient wrapper around the redis manager which has the affect of calling GetClient() for all write operations and GetReadOnlyClient() for the read ones.
This works well for master-replica replication scenarios where you have 1 master that replicates to multiple read replicas.
Assembly: ServiceStack.Redis.dll
View Source
public class RedisClientManagerCacheClient : ICacheClientAsync, IRemoveByPatternAsync, IRemoveByPattern, ICacheClientExtended, ICacheClient, IDisposable
Properties
ReadOnly
View Source
public bool ReadOnly { get; set; }
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.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
Task ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.CancellationToken | token |
IRemoveByPatternAsync.RemoveByPatternAsync(String, CancellationToken)
View Source
async Task IRemoveByPatternAsync.RemoveByPatternAsync(string pattern, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.String | pattern |
System.Threading.CancellationToken | token |
IRemoveByPatternAsync.RemoveByRegexAsync(String, CancellationToken)
View Source
async Task IRemoveByPatternAsync.RemoveByRegexAsync(string regex, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.String | regex |
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
Dispose()
Ignore dispose on RedisClientsManager, which should be registered as a singleton
View Source
public void Dispose()
Get<T>(String)
View Source
public T Get<T>(string key)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | key |
Type Parameters
T
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
GetClient()
View Source
public ICacheClient GetClient()
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 |
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()
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
RemoveByPattern(String)
View Source
public void RemoveByPattern(string pattern)
Parameters
Type | Name |
---|---|
System.String | pattern |
RemoveByRegex(String)
View Source
public void RemoveByRegex(string pattern)
Parameters
Type | Name |
---|---|
System.String | pattern |
GetTimeToLive(String)
View Source
public TimeSpan? GetTimeToLive(string key)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
System.String | key |
GetKeysByPattern(String)
View Source
public IEnumerable<string> GetKeysByPattern(string pattern)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
System.String | pattern |
RemoveExpiredEntries()
View Source
public void RemoveExpiredEntries()
Implements
- ServiceStack.Caching.ICacheClientAsync
IAsyncDisposable
- ServiceStack.Caching.IRemoveByPatternAsync
IAsyncDisposable
- ServiceStack.Caching.IRemoveByPattern
- ServiceStack.Caching.ICacheClientExtended
- ServiceStack.Caching.ICacheClient
System.IDisposable