1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Common/Cache/CacheManger.cs
kay.one 4da6654440 Added Auth, startup options to UI
Added caching to ConfigFileProvider,
2013-05-22 22:12:15 -07:00

34 lines
742 B
C#

using System;
using NzbDrone.Common.EnsureThat;
namespace NzbDrone.Common.Cache
{
public interface ICacheManger
{
ICached<T> GetCache<T>(Type type);
ICached<T> GetCache<T>(object host);
}
public class CacheManger : ICacheManger
{
private readonly ICached<object> _cache;
public CacheManger()
{
_cache = new Cached<object>();
}
public ICached<T> GetCache<T>(Type type)
{
Ensure.That(() => type).IsNotNull();
return (ICached<T>)_cache.Get(type.FullName, () => new Cached<T>());
}
public ICached<T> GetCache<T>(object host)
{
return GetCache<T>(host.GetType());
}
}
}