Class CacheProviderExtensions
Class that provides helper methods for configuring CacheProviders.
public static class CacheProviderExtensions
- Inheritance
-
CacheProviderExtensions
- Inherited Members
Methods
AsyncFor<TCacheFormat>(IAsyncCacheProvider)
Provides a strongly TCacheFormat
-typed version of the supplied IAsyncCacheProvider
public static IAsyncCacheProvider<TCacheFormat> AsyncFor<TCacheFormat>(this IAsyncCacheProvider nonGenericCacheProvider)
Parameters
nonGenericCacheProvider
IAsyncCacheProviderThe non-generic cache provider to wrap.
Returns
- IAsyncCacheProvider<TCacheFormat>
IAsyncCacheProvider{TCacheFormat}.
Type Parameters
TCacheFormat
The type the returned IAsyncCacheProvider<TResult> will handle.
For<TCacheFormat>(ISyncCacheProvider)
Provides a strongly TCacheFormat
-typed version of the supplied ISyncCacheProvider
public static ISyncCacheProvider<TCacheFormat> For<TCacheFormat>(this ISyncCacheProvider nonGenericCacheProvider)
Parameters
nonGenericCacheProvider
ISyncCacheProviderThe non-generic cache provider to wrap.
Returns
- ISyncCacheProvider<TCacheFormat>
ISyncCacheProvider{TCacheFormat}.
Type Parameters
TCacheFormat
The type the returned ISyncCacheProvider<TResult> will handle.
WithSerializer<TSerialized>(IAsyncCacheProvider<TSerialized>, ICacheItemSerializer<object, TSerialized>)
Wraps the serializer
around the asynchronous cacheProvider
so that delegate return values of any type can be stored in the cache as type TSerialized
.
public static SerializingCacheProviderAsync<TSerialized> WithSerializer<TSerialized>(this IAsyncCacheProvider<TSerialized> cacheProvider, ICacheItemSerializer<object, TSerialized> serializer)
Parameters
cacheProvider
IAsyncCacheProvider<TSerialized>The cache provider.
serializer
ICacheItemSerializer<object, TSerialized>A serializer which can serialize/deserialize all types to/from
TSerialized
.
Returns
- SerializingCacheProviderAsync<TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TSerialized
The type of serialized objects to be placed in the cache.
WithSerializer<TSerialized>(ISyncCacheProvider<TSerialized>, ICacheItemSerializer<object, TSerialized>)
Wraps the serializer
around the cacheProvider
so that delegate return values of any type can be stored in the cache as type TSerialized
.
public static SerializingCacheProvider<TSerialized> WithSerializer<TSerialized>(this ISyncCacheProvider<TSerialized> cacheProvider, ICacheItemSerializer<object, TSerialized> serializer)
Parameters
cacheProvider
ISyncCacheProvider<TSerialized>The cache provider.
serializer
ICacheItemSerializer<object, TSerialized>A serializer which can serialize/deserialize all types to/from
TSerialized
.
Returns
- SerializingCacheProvider<TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TSerialized
The type of serialized objects to be placed in the cache.
WithSerializer<TResult, TSerialized>(IAsyncCacheProvider<TSerialized>, ICacheItemSerializer<TResult, TSerialized>)
Wraps the serializer
around the asynchronous cacheProvider
so that delegate return values of type TResult
can be stored in the cache as type TSerialized
.
public static SerializingCacheProviderAsync<TResult, TSerialized> WithSerializer<TResult, TSerialized>(this IAsyncCacheProvider<TSerialized> cacheProvider, ICacheItemSerializer<TResult, TSerialized> serializer)
Parameters
cacheProvider
IAsyncCacheProvider<TSerialized>The cache provider.
serializer
ICacheItemSerializer<TResult, TSerialized>The serializer.
Returns
- SerializingCacheProviderAsync<TResult, TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TResult
The return type of delegates which may be executed through the policy.
TSerialized
The type of serialized objects to be placed in the cache.
WithSerializer<TResult, TSerialized>(ISyncCacheProvider<TSerialized>, ICacheItemSerializer<TResult, TSerialized>)
Wraps the serializer
around the cacheProvider
so that delegate return values of type TResult
can be stored in the cache as type TSerialized
.
public static SerializingCacheProvider<TResult, TSerialized> WithSerializer<TResult, TSerialized>(this ISyncCacheProvider<TSerialized> cacheProvider, ICacheItemSerializer<TResult, TSerialized> serializer)
Parameters
cacheProvider
ISyncCacheProvider<TSerialized>The cache provider.
serializer
ICacheItemSerializer<TResult, TSerialized>The serializer.
Returns
- SerializingCacheProvider<TResult, TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TResult
The return type of delegates which may be executed through the policy.
TSerialized
The type of serialized objects to be placed in the cache.