Class SerializingCacheProvider<TSerialized>
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
stringThe 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)