public MediaCacheService() { var memCache = new MemoryCacheProvider(); var dbConfig = new DbConfiguration(new SqliteFactory()); var repo = new SettingsJsonRepository(dbConfig, memCache); ConfigurationReader = new ConfigurationReader(); CpCacher = new CouchPotatoCacher(new SettingsServiceV2 <CouchPotatoSettings>(repo), new CouchPotatoApi(), memCache); SonarrCacher = new SonarrCacher(new SettingsServiceV2 <SonarrSettings>(repo), new SonarrApi(), memCache); SickRageCacher = new SickRageCacher(new SettingsServiceV2 <SickRageSettings>(repo), new SickrageApi(), memCache); HostingEnvironment.RegisterObject(this); }
public void Start(Configuration c) { CpSubscription?.Dispose(); SonarrSubscription?.Dispose(); SickRageSubscription?.Dispose(); Task.Factory.StartNew(() => CpCacher.Queued(-1)); Task.Factory.StartNew(() => SonarrCacher.Queued(-1)); Task.Factory.StartNew(() => SickRageCacher.Queued(-1)); CpSubscription = Observable.Interval(c.Intervals.Notification).Subscribe(CpCacher.Queued); SonarrSubscription = Observable.Interval(c.Intervals.Notification).Subscribe(SonarrCacher.Queued); SickRageSubscription = Observable.Interval(c.Intervals.Notification).Subscribe(SickRageCacher.Queued); }