Table of Contents

Interface ICache<TKey, TValue>

Namespace
Amazon.Runtime.Internal.Util
Assembly
AWSSDK.Core.dll

Interface for a generic cache.

public interface ICache<TKey, TValue> : ICache

Type Parameters

TKey
TValue
Inherited Members

Properties

Keys

Returns the keys for all items in the cache.

List<TKey> Keys { get; }

Property Value

List<TKey>

Methods

Clear(TKey)

Clears a specific value from the cache if it's there.

void Clear(TKey key)

Parameters

key TKey

GetValue(TKey, Func<TKey, TValue>)

Retrieves a value out of the cache or from the source.

TValue GetValue(TKey key, Func<TKey, TValue> creator)

Parameters

key TKey
creator Func<TKey, TValue>

Returns

TValue

GetValue(TKey, Func<TKey, TValue>, out bool)

Retrieves a value out of the cache or from the source. If the item was in the cache, isStaleItem is set to true; otherwise, if the item comes from the source, isStaleItem is false.

TValue GetValue(TKey key, Func<TKey, TValue> creator, out bool isStaleItem)

Parameters

key TKey
creator Func<TKey, TValue>
isStaleItem bool

Returns

TValue

UseCache<TOut>(TKey, Func<TOut>, Action, Predicate<Exception>)

Executes specified operation, catches exception, clears the cache for the given key, retries the operation.

TOut UseCache<TOut>(TKey key, Func<TOut> operation, Action onError, Predicate<Exception> shouldRetryForException)

Parameters

key TKey
operation Func<TOut>
onError Action
shouldRetryForException Predicate<Exception>

Returns

TOut

Type Parameters

TOut