using System; using NzbDrone.Common.EnsureThat; namespace NzbDrone.Common.Cache { public interface ICacheManger { ICached GetCache(Type host, string name); ICached GetCache(Type host); } public class CacheManger : ICacheManger { private readonly ICached _cache; public CacheManger() { _cache = new Cached(); } public ICached GetCache(Type host) { Ensure.That(() => host).IsNotNull(); return GetCache(host, host.FullName); } public ICached GetCache(Type host, string name) { Ensure.That(() => host).IsNotNull(); Ensure.That(() => name).IsNotNullOrWhiteSpace(); return (ICached)_cache.Get(host.FullName + "_" + name, () => new Cached()); } } }