static Leadtools.Dicom.Imaging.Tasks.CachingTasksCleanup.LTCleanCacheState CreateCleanupCacheState(LTCacheSettings settings) { var cleanCacheState = new Leadtools.Dicom.Imaging.Tasks.CachingTasksCleanup.LTCleanCacheState(); if (settings.Enabled) { cleanCacheState.CacheFolder = settings.Storage; cleanCacheState.Lifetime = settings.Lifetime; } else { cleanCacheState.CacheFolder = string.Empty; } return(cleanCacheState); }
public static void QeueuWorkers() { try { //BG worker if (CacheSettings.Enabled && CacheSettings.EnabledOnStore) { var license = ServiceUtils.MapConfigPath(ConfigurationManager.AppSettings["license"]); var key = ConfigurationManager.AppSettings["key"]; //out of process dispatch var m = typeof(Leadtools.Dicom.Imaging.Tasks.CachingTasksImport).GetMethod("Run"); var p = new Leadtools.Dicom.Imaging.Tasks.CachingTasksImport.param() { license = license, key = key, cacheStore = CacheSettings.Storage }; OutOfProcessTaskDispatcher.Instance.RunOne(m, p); //local dispatch //RecurringTasksDispatcher.Instance.AddAction(ImportIntoCache, null); } //BG worker if (CacheSettings.Enabled) { //no cleanup if 0 is specified if (CacheSettings.Lifetime.TotalSeconds != 0) { _cleanCacheState = CreateCleanupCacheState(CacheSettings); RecurringTasksDispatcher.Instance.AddAction(Leadtools.Dicom.Imaging.Tasks.CachingTasksCleanup.CleanupCache, _cleanCacheState); } } } catch { //ignored } }