コード例 #1
0
ファイル: LTCachingCtrl.cs プロジェクト: sakpung/webstudy
 public static void Refresh()
 {
     lock (_cacheSettingsLock)
     {
         _cacheSettings = null;
     }
 }
コード例 #2
0
ファイル: LTCachingCtrl.cs プロジェクト: sakpung/webstudy
        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);
        }
コード例 #3
0
ファイル: LTCachingCtrl.cs プロジェクト: sakpung/webstudy
        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);
            }
        }
コード例 #4
0
ファイル: LTCachingCtrl.cs プロジェクト: sakpung/webstudy
 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);
     }
 }
コード例 #5
0
ファイル: LTCachingCtrl.cs プロジェクト: sakpung/webstudy
        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);
        }