added TTL to cached objects

This commit is contained in:
Keivan Beigi 2013-07-23 17:35:35 -07:00
commit 121f3b973d
11 changed files with 160 additions and 141 deletions

View file

@ -5,19 +5,15 @@ namespace NzbDrone.Common.Cache
{
public interface ICached
{
bool ContainsKey(string key);
void Clear();
void Remove(string key);
}
public interface ICached<T> : ICached
{
void Set(string key, T value);
T Get(string key, Func<T> function);
T Get(string key);
void Set(string key, T value, TimeSpan? lifetime = null);
T Get(string key, Func<T> function, TimeSpan? lifeTime = null);
T Find(string key);
ICollection<T> Values { get; }
ICollection<string> Keys { get; }
}
}