Skip to main content

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
Declaration
public class RedisClientManagerCacheClient : ICacheClientAsync, IRemoveByPatternAsync, IRemoveByPattern, ICacheClientExtended, ICacheClient, IDisposable

Properties

ReadOnly

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

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.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
Task ICacheClientAsync.RemoveExpiredEntriesAsync(CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Threading.CancellationTokentoken

IRemoveByPatternAsync.RemoveByPatternAsync(String, CancellationToken)

View Source
Declaration
async Task IRemoveByPatternAsync.RemoveByPatternAsync(string pattern, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Stringpattern
System.Threading.CancellationTokentoken

IRemoveByPatternAsync.RemoveByRegexAsync(String, CancellationToken)

View Source
Declaration
async Task IRemoveByPatternAsync.RemoveByRegexAsync(string regex, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Stringregex
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

Dispose()

Ignore dispose on RedisClientsManager, which should be registered as a singleton

View Source
Declaration
public void Dispose()

Get<T>(String)

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

<T>

Parameters
TypeName
System.Stringkey
Type Parameters
  • T

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

GetClient()

View Source
Declaration
public ICacheClient GetClient()
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

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()

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

RemoveByPattern(String)

View Source
Declaration
public void RemoveByPattern(string pattern)
Parameters
TypeName
System.Stringpattern

RemoveByRegex(String)

View Source
Declaration
public void RemoveByRegex(string pattern)
Parameters
TypeName
System.Stringpattern

GetTimeToLive(String)

View Source
Declaration
public TimeSpan? GetTimeToLive(string key)
Returns

System.Nullable<System.TimeSpan>

Parameters
TypeName
System.Stringkey

GetKeysByPattern(String)

View Source
Declaration
public IEnumerable<string> GetKeysByPattern(string pattern)
Returns

System.Collections.Generic.IEnumerable<System.String>

Parameters
TypeName
System.Stringpattern

RemoveExpiredEntries()

View Source
Declaration
public void RemoveExpiredEntries()

Implements