public static void Refresh() { lock (_cacheSettingsLock) { _cacheSettings = null; } }
static LTCacheSettings ReadCacheSettings() { var cacheSettings = new LTCacheSettings(); if (!bool.TryParse(ConfigurationManager.AppSettings.Get("Caching.Enabled"), out cacheSettings.Enabled)) { cacheSettings.Enabled = false; } cacheSettings.Storage = ConfigurationManager.AppSettings.Get("Caching.Storage"); if (string.IsNullOrEmpty(cacheSettings.Storage)) { cacheSettings.Storage = GetDefaultCacheStorage(); } if (string.IsNullOrEmpty(cacheSettings.Storage)) { cacheSettings.Enabled = false; } if (cacheSettings.Enabled) { if (!bool.TryParse(ConfigurationManager.AppSettings.Get("Caching.OnStore"), out cacheSettings.EnabledOnStore)) { cacheSettings.EnabledOnStore = false; } if (!int.TryParse(ConfigurationManager.AppSettings.Get("Caching.Threshold"), out cacheSettings.Threshold)) { cacheSettings.Threshold = 0; } if (!int.TryParse(ConfigurationManager.AppSettings.Get("Caching.DiskQuota"), out cacheSettings.DiskQuota)) { cacheSettings.DiskQuota = 0; } if (!bool.TryParse(ConfigurationManager.AppSettings.Get("Caching.FastResizeHugeFrames"), out cacheSettings.FastResizeHugeFrames)) { cacheSettings.FastResizeHugeFrames = false; } if (!TimeSpan.TryParse(ConfigurationManager.AppSettings.Get("Caching.Lifetime"), out cacheSettings.Lifetime)) { cacheSettings.Lifetime = TimeSpan.FromDays(1); } } return(cacheSettings); }
public static Leadtools.Dicom.Imaging.IDataCacheProvider CreateCache(LTCacheSettings settings) { Leadtools.Dicom.Imaging.Config.CachingConfiguration.Instance.Threshold = settings.Threshold; Leadtools.Dicom.Imaging.Config.CachingConfiguration.Instance.CachingDiskQuota = settings.DiskQuota; Leadtools.Dicom.Imaging.Config.CachingConfiguration.Instance.FastResizeHugeFrames = settings.FastResizeHugeFrames; if (settings.Enabled) { var dataCache = new Leadtools.Dicom.Imaging.DiskDataCacheProvider(new Leadtools.Dicom.Imaging.DiskDataCacheStorage(settings.Storage)); return(dataCache); } else { var dataCache = new Leadtools.Dicom.Imaging.DataCachelessProvider(); return(dataCache); } }
public static Leadtools.Dicom.Imaging.DiskDataCacheStorage CreateCacheStorage(LTCacheSettings settings) { if (settings.Enabled) { var dataCacheStorage = new Leadtools.Dicom.Imaging.DiskDataCacheStorage(settings.Storage); return(dataCacheStorage); } else { return(null); } }
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); }