29 lines
No EOL
811 B
C#
29 lines
No EOL
811 B
C#
namespace JD.Collections
|
|
{
|
|
/// <summary>
|
|
/// Caches values based on a key.
|
|
/// (only missing the object creation).
|
|
/// </summary>
|
|
public abstract class AbstractKeyedCache<TKey, TValue> : KeyedCacheBase<TKey, TValue>
|
|
{
|
|
/// <summary>
|
|
/// Returns the value for the key, (if not cached, will use the provider).
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public TValue this[TKey key]
|
|
{
|
|
get
|
|
{
|
|
return base[key, CreateValue];
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a value for the key.
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
protected abstract TValue CreateValue(TKey key);
|
|
}
|
|
} |