CacheClientExtensions
Assembly: ServiceStack.dll
View Source
public static class CacheClientExtensions
Methods
Set<T>(ICacheClient, String, T, Nullable<TimeSpan>)
View Source
public static void Set<T>(this ICacheClient cache, string cacheKey, T value, TimeSpan? expireCacheIn)
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | cacheKey |
<T> | value |
System.Nullable<System.TimeSpan> | expireCacheIn |
Type Parameters
T
SetAsync<T>(ICacheClientAsync, String, T, Nullable<TimeSpan>, CancellationToken)
View Source
public static async Task SetAsync<T>(this ICacheClientAsync cache, string cacheKey, T value, TimeSpan? expireCacheIn, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | cacheKey |
<T> | value |
System.Nullable<System.TimeSpan> | expireCacheIn |
System.Threading.CancellationToken | token |
Type Parameters
T
GetDate(IRequest)
View Source
public static DateTime? GetDate(this IRequest req)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetIfModifiedSince(IRequest)
View Source
public static DateTime? GetIfModifiedSince(this IRequest req)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
HasValidCache(ICacheClient, IRequest, String, Nullable<DateTime>, out Nullable<DateTime>)
View Source
public static bool HasValidCache(this ICacheClient cache, IRequest req, string cacheKey, DateTime? checkLastModified, out DateTime? lastModified)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
ServiceStack.Web.IRequest | req |
System.String | cacheKey |
System.Nullable<System.DateTime> | checkLastModified |
System.Nullable<System.DateTime> | lastModified |
HasValidCacheAsync(ICacheClientAsync, IRequest, String, Nullable<DateTime>, CancellationToken)
View Source
public static async Task<CacheClientExtensions.ValidCache> HasValidCacheAsync(this ICacheClientAsync cache, IRequest req, string cacheKey, DateTime? checkLastModified, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<ServiceStack.CacheClientExtensions.ValidCache>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
ServiceStack.Web.IRequest | req |
System.String | cacheKey |
System.Nullable<System.DateTime> | checkLastModified |
System.Threading.CancellationToken | token |
ResolveFromCache(ICacheClient, String, IRequest)
View Source
public static object ResolveFromCache(this ICacheClient cache, string cacheKey, IRequest req)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | cacheKey |
ServiceStack.Web.IRequest | req |
ResolveFromCacheAsync(ICacheClientAsync, String, IRequest, CancellationToken)
View Source
public static async Task<object> ResolveFromCacheAsync(this ICacheClientAsync cache, string cacheKey, IRequest req, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | cacheKey |
ServiceStack.Web.IRequest | req |
System.Threading.CancellationToken | token |
Cache(ICacheClient, String, Object, IRequest, Nullable<TimeSpan>)
View Source
public static object Cache(this ICacheClient cache, string cacheKey, object responseDto, IRequest req, TimeSpan? expireCacheIn = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | cacheKey |
System.Object | responseDto |
ServiceStack.Web.IRequest | req |
System.Nullable<System.TimeSpan> | expireCacheIn |
CacheAsync(ICacheClientAsync, String, Object, IRequest, Nullable<TimeSpan>, CancellationToken)
View Source
public static async Task<object> CacheAsync(this ICacheClientAsync cache, string cacheKey, object responseDto, IRequest req, TimeSpan? expireCacheIn = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | cacheKey |
System.Object | responseDto |
ServiceStack.Web.IRequest | req |
System.Nullable<System.TimeSpan> | expireCacheIn |
System.Threading.CancellationToken | token |
ClearCaches(ICacheClient, String[])
View Source
public static void ClearCaches(this ICacheClient cache, params string[] cacheKeys)
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String[] | cacheKeys |
ClearCachesAsync(ICacheClientAsync, String[], CancellationToken)
View Source
public static async Task ClearCachesAsync(this ICacheClientAsync cache, string[] cacheKeys, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String[] | cacheKeys |
System.Threading.CancellationToken | token |
GetCacheKeyForSerialized(String, String, String)
View Source
public static string GetCacheKeyForSerialized(string cacheKey, string mimeType, string modifiers)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | cacheKey |
System.String | mimeType |
System.String | modifiers |
GetCacheKeyForCompressed(String, String)
View Source
public static string GetCacheKeyForCompressed(string cacheKeySerialized, string compressionType)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | cacheKeySerialized |
System.String | compressionType |
RemoveByPattern(ICacheClient, String)
Removes items from cache that have keys matching the specified wildcard pattern
View Source
public static void RemoveByPattern(this ICacheClient cacheClient, string pattern)
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Caching.ICacheClient | cacheClient | Cache client |
|
| System.String
| pattern | The wildcard, where "*" means any sequence of characters and "?" means any single character.
|
RemoveByPatternAsync(ICacheClientAsync, String, CancellationToken)
Removes items from cache that have keys matching the specified wildcard pattern
View Source
public static Task RemoveByPatternAsync(this ICacheClientAsync cacheClient, string pattern, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Caching.ICacheClientAsync | cacheClient | Cache client |
|
| System.String
| pattern | The wildcard, where "*" means any sequence of characters and "?" means any single character.
|
| System.Threading.CancellationToken
| token |
|
RemoveByRegex(ICacheClient, String)
Removes items from the cache based on the specified regular expression pattern
View Source
public static void RemoveByRegex(this ICacheClient cacheClient, string regex)
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Caching.ICacheClient | cacheClient | Cache client |
|
| System.String
| regex | Regular expression pattern to search cache keys
|
RemoveByRegexAsync(ICacheClientAsync, String)
Removes items from the cache based on the specified regular expression pattern
View Source
public static Task RemoveByRegexAsync(this ICacheClientAsync cacheClient, string regex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Caching.ICacheClientAsync | cacheClient | Cache client |
|
| System.String
| regex | Regular expression pattern to search cache keys
|
GetKeysByPattern(ICacheClient, String)
View Source
public static IEnumerable<string> GetKeysByPattern(this ICacheClient cache, string pattern)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | pattern |
GetAllKeys(ICacheClient)
View Source
public static IEnumerable<string> GetAllKeys(this ICacheClient cache)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
GetKeysStartingWith(ICacheClient, String)
View Source
public static IEnumerable<string> GetKeysStartingWith(this ICacheClient cache, string prefix)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | prefix |
GetKeysByPatternAsync(ICacheClientAsync, String)
View Source
public static IAsyncEnumerable<string> GetKeysByPatternAsync(this ICacheClientAsync cache, string pattern)
Returns
IAsyncEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | pattern |
GetAllKeysAsync(ICacheClientAsync)
View Source
public static async IAsyncEnumerable<string> GetAllKeysAsync(this ICacheClientAsync cache)
Returns
IAsyncEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
GetKeysStartingWithAsync(ICacheClientAsync, String)
View Source
public static async IAsyncEnumerable<string> GetKeysStartingWithAsync(this ICacheClientAsync cache, string prefix)
Returns
IAsyncEnumerable<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | prefix |
GetOrCreate<T>(ICacheClient, String, Func<T>)
View Source
public static T GetOrCreate<T>(this ICacheClient cache, string key, Func<T> createFn)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | key |
System.Func<<T>> | createFn |
Type Parameters
T
GetOrCreateAsync<T>(ICacheClientAsync, String, Func<Task<T>>)
View Source
public static async Task<T> GetOrCreateAsync<T>(this ICacheClientAsync cache, string key, Func<Task<T>> createFn)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | key |
System.Func<System.Threading.Tasks.Task<<T>>> | createFn |
Type Parameters
T
GetOrCreate<T>(ICacheClient, String, TimeSpan, Func<T>)
View Source
public static T GetOrCreate<T>(this ICacheClient cache, string key, TimeSpan expiresIn, Func<T> createFn)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | key |
System.TimeSpan | expiresIn |
System.Func<<T>> | createFn |
Type Parameters
T
GetOrCreateAsync<T>(ICacheClientAsync, String, TimeSpan, Func<Task<T>>)
View Source
public static async Task<T> GetOrCreateAsync<T>(this ICacheClientAsync cache, string key, TimeSpan expiresIn, Func<Task<T>> createFn)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClientAsync | cache |
System.String | key |
System.TimeSpan | expiresIn |
System.Func<System.Threading.Tasks.Task<<T>>> | createFn |
Type Parameters
T
GetTimeToLive(ICacheClient, String)
View Source
public static TimeSpan? GetTimeToLive(this ICacheClient cache, string key)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
ServiceStack.Caching.ICacheClient | cache |
System.String | key |