1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 09:49:00 +00:00

Cahce.Remove is now void

Added tests for Cache.Remove
This commit is contained in:
Keivan Beigi 2013-08-30 15:14:44 -07:00 committed by Mark McDowall
parent 56cd80d24a
commit 772ab3c921
3 changed files with 19 additions and 9 deletions

View file

@ -48,6 +48,23 @@ public void should_be_able_to_update_key()
_cachedString.Find("Key").Should().Be("New");
}
[Test]
public void should_be_able_to_remove_key()
{
_cachedString.Set("Key", "Value");
_cachedString.Remove("Key");
_cachedString.Find("Key").Should().BeNull();
}
[Test]
public void should_be_able_to_remove_non_existing_key()
{
_cachedString.Remove("Key");
}
[Test]
public void should_store_null()
{

View file

@ -61,17 +61,10 @@ public T Find(string key)
return value.Object;
}
public T Remove(string key)
public void Remove(string key)
{
CacheItem value;
_store.TryRemove(key, out value);
if (value == null)
{
return default(T);
}
return value.Object;
}
public T Get(string key, Func<T> function, TimeSpan? lifeTime = null)

View file

@ -13,7 +13,7 @@ public interface ICached<T> : ICached
void Set(string key, T value, TimeSpan? lifetime = null);
T Get(string key, Func<T> function, TimeSpan? lifeTime = null);
T Find(string key);
T Remove(string key);
void Remove(string key);
ICollection<T> Values { get; }
}