Table of Contents

Class SerializingCacheProvider<TSerialized>

Namespace
Polly.Caching
Assembly
Polly.dll

Defines an ISyncCacheProvider which serializes objects of any type in and out of an underlying cache which caches as type TSerialized. For use with synchronous CachePolicy.

public class SerializingCacheProvider<TSerialized> : ISyncCacheProvider

Type Parameters

TSerialized

The type of serialized objects to be placed in the cache.

Inheritance
SerializingCacheProvider<TSerialized>
Implements
Inherited Members
Extension Methods

Constructors

SerializingCacheProvider(ISyncCacheProvider<TSerialized>, ICacheItemSerializer<object, TSerialized>)

Initializes a new instance of the SerializingCacheProvider<TResult, TSerialized> class.

public SerializingCacheProvider(ISyncCacheProvider<TSerialized> wrappedCacheProvider, ICacheItemSerializer<object, TSerialized> serializer)

Parameters

wrappedCacheProvider ISyncCacheProvider<TSerialized>

The wrapped cache provider.

serializer ICacheItemSerializer<object, TSerialized>

The serializer.

Exceptions

ArgumentNullException

wrappedCacheProvider

ArgumentNullException

serializer

Methods

Get(string)

Gets a value from the cache.

public object Get(string key)

Parameters

key string

The cache key.

Returns

object

The value from cache; or null, if none was found.

Put(string, object, Ttl)

Puts the specified value in the cache.

public void Put(string key, object value, Ttl ttl)

Parameters

key string

The cache key.

value object

The value to put into the cache.

ttl Ttl

The time-to-live for the cache entry.