@ -1,4 +1,5 @@
using System ;
using System ;
using System.Collections.Generic ;
using NzbDrone.Common.EnsureThat ;
using NzbDrone.Common.EnsureThat ;
namespace NzbDrone.Common.Cache
namespace NzbDrone.Common.Cache
@ -7,15 +8,18 @@ namespace NzbDrone.Common.Cache
{
{
ICached < T > GetCache < T > ( Type host , string name ) ;
ICached < T > GetCache < T > ( Type host , string name ) ;
ICached < T > GetCache < T > ( Type host ) ;
ICached < T > GetCache < T > ( Type host ) ;
//ICollection<ICached<T>> Caches<T> { get;}
void Clear ( ) ;
ICollection < ICached > Caches { get ; }
}
}
public class CacheManger : ICacheManger
public class CacheManger : ICacheManger
{
{
private readonly ICached < object > _cache ;
private readonly ICached < ICached > _cache ;
public CacheManger ( )
public CacheManger ( )
{
{
_cache = new Cached < object > ( ) ;
_cache = new Cached < ICached > ( ) ;
}
}
@ -25,6 +29,14 @@ namespace NzbDrone.Common.Cache
return GetCache < T > ( host , host . FullName ) ;
return GetCache < T > ( host , host . FullName ) ;
}
}
public void Clear ( )
{
_cache . Clear ( ) ;
}
public ICollection < ICached > Caches { get { return _cache . Values ; } }
public ICached < T > GetCache < T > ( Type host , string name )
public ICached < T > GetCache < T > ( Type host , string name )
{
{
Ensure . That ( ( ) = > host ) . IsNotNull ( ) ;
Ensure . That ( ( ) = > host ) . IsNotNull ( ) ;