mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Tuned down DB logging
Added cache to scene mapping.
This commit is contained in:
parent
2a12b051bc
commit
acf54203e5
8 changed files with 68 additions and 31 deletions
|
@ -5,8 +5,8 @@ namespace NzbDrone.Common.Cache
|
|||
{
|
||||
public interface ICacheManger
|
||||
{
|
||||
ICached<T> GetCache<T>(Type type);
|
||||
ICached<T> GetCache<T>(object host);
|
||||
ICached<T> GetCache<T>(Type host, string name);
|
||||
ICached<T> GetCache<T>(Type host);
|
||||
}
|
||||
|
||||
public class CacheManger : ICacheManger
|
||||
|
@ -19,16 +19,18 @@ namespace NzbDrone.Common.Cache
|
|||
|
||||
}
|
||||
|
||||
public ICached<T> GetCache<T>(Type type)
|
||||
public ICached<T> GetCache<T>(Type host)
|
||||
{
|
||||
Ensure.That(() => type).IsNotNull();
|
||||
|
||||
return (ICached<T>)_cache.Get(type.FullName, () => new Cached<T>());
|
||||
Ensure.That(() => host).IsNotNull();
|
||||
return GetCache<T>(host, host.FullName);
|
||||
}
|
||||
|
||||
public ICached<T> GetCache<T>(object host)
|
||||
public ICached<T> GetCache<T>(Type host, string name)
|
||||
{
|
||||
return GetCache<T>(host.GetType());
|
||||
Ensure.That(() => host).IsNotNull();
|
||||
Ensure.That(() => name).IsNotNullOrWhiteSpace();
|
||||
|
||||
return (ICached<T>)_cache.Get(host.FullName + "_" + name, () => new Cached<T>());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue