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
nonGenericCacheProviderIAsyncCacheProviderThe non-generic cache provider to wrap.
Returns
- IAsyncCacheProvider<TCacheFormat>
IAsyncCacheProvider{TCacheFormat}.
Type Parameters
TCacheFormatThe 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
nonGenericCacheProviderISyncCacheProviderThe non-generic cache provider to wrap.
Returns
- ISyncCacheProvider<TCacheFormat>
ISyncCacheProvider{TCacheFormat}.
Type Parameters
TCacheFormatThe 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
cacheProviderIAsyncCacheProvider<TSerialized>The cache provider.
serializerICacheItemSerializer<object, TSerialized>A serializer which can serialize/deserialize all types to/from
TSerialized.
Returns
- SerializingCacheProviderAsync<TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TSerializedThe 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
cacheProviderISyncCacheProvider<TSerialized>The cache provider.
serializerICacheItemSerializer<object, TSerialized>A serializer which can serialize/deserialize all types to/from
TSerialized.
Returns
- SerializingCacheProvider<TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TSerializedThe 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
cacheProviderIAsyncCacheProvider<TSerialized>The cache provider.
serializerICacheItemSerializer<TResult, TSerialized>The serializer.
Returns
- SerializingCacheProviderAsync<TResult, TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TResultThe return type of delegates which may be executed through the policy.
TSerializedThe 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
cacheProviderISyncCacheProvider<TSerialized>The cache provider.
serializerICacheItemSerializer<TResult, TSerialized>The serializer.
Returns
- SerializingCacheProvider<TResult, TSerialized>
SerializingCacheProvider<TResult, TSerialized>.
Type Parameters
TResultThe return type of delegates which may be executed through the policy.
TSerializedThe type of serialized objects to be placed in the cache.