Class SerializingCacheProviderAsync<TSerialized>
Defines an IAsyncCacheProvider which serializes objects of any type in and out of an underlying cache which caches as type TSerialized.  For use with asynchronous CachePolicy.
public class SerializingCacheProviderAsync<TSerialized> : IAsyncCacheProviderType Parameters
- TSerialized
- The type of serialized objects to be placed in the cache. 
- Inheritance
- 
      
      SerializingCacheProviderAsync<TSerialized>
- Implements
- Inherited Members
- Extension Methods
Constructors
SerializingCacheProviderAsync(IAsyncCacheProvider<TSerialized>, ICacheItemSerializer<object, TSerialized>)
Initializes a new instance of the SerializingCacheProviderAsync<TResult, TSerialized> class.
public SerializingCacheProviderAsync(IAsyncCacheProvider<TSerialized> wrappedCacheProvider, ICacheItemSerializer<object, TSerialized> serializer)Parameters
- wrappedCacheProviderIAsyncCacheProvider<TSerialized>
- The wrapped cache provider. 
- serializerICacheItemSerializer<object, TSerialized>
- The serializer. 
Exceptions
- ArgumentNullException
- wrappedCacheProvider 
- ArgumentNullException
- serializer 
Methods
GetAsync(string, CancellationToken, bool)
Gets a value from the cache asynchronously.
public Task<object> GetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext)Parameters
- keystring
- The cache key. 
- cancellationTokenCancellationToken
- The cancellation token. 
- continueOnCapturedContextbool
- Whether async calls should continue on a captured synchronization context. 
Returns
- Task<object>
- A Task<TResult> promising as Result the value from cache; or null, if none was found. 
PutAsync(string, object, Ttl, CancellationToken, bool)
Puts the specified value in the cache asynchronously.
public Task PutAsync(string key, object value, Ttl ttl, CancellationToken cancellationToken, bool continueOnCapturedContext)Parameters
- keystring
- The cache key. 
- valueobject
- The value to put into the cache. 
- ttlTtl
- The time-to-live for the cache entry. 
- cancellationTokenCancellationToken
- The cancellation token. 
- continueOnCapturedContextbool
- Whether async calls should continue on a captured synchronization context.