static void LoadSettings() { settingsLock.AcquireWriterLock(Timeout.Infinite); try { if (cache != null) { cache.Dispose(); } _settings = ConfigurationProvider.Settings; // bool validLicense = Alachisoft.NCache.ContentOptimization.Licensing.LicesnseManager.IsLicenseValid; /* if (!validLicense) * { * FileBasedTraceProvider.Current.WriteTrace(TraceSeverity.CriticalEvent, "License not verified"); * _settings.EnableViewstateCaching = false; * } */ if (_settings.Enabled) { if (_settings.CacheSettings == null) { throw new Exception("Cache settings not set"); } var cacheAdapter = new CacheAdapter(_settings.CacheSettings.CacheName); cacheAdapter.RetryInterval = _settings.CacheSettings.ConnectionRetryInterval.HasValue ? _settings.CacheSettings.ConnectionRetryInterval.Value : 300; cacheAdapter.Load(); if (_settings.CacheSettings.Expiration == null) { throw new Exception("Expiration settings not set"); } cacheAdapter.DefaultExpiration = _settings.CacheSettings.Expiration.Convert(); cache = cacheAdapter.GetSynchronized(settingsLock); } } finally { settingsLock.ReleaseWriterLock(); } }
static void LoadSettings() { settingsLock.AcquireWriterLock(Timeout.Infinite); try { if (cache != null) { cache.Dispose(); } _settings = ConfigurationProvider.Settings; if (_settings.Enabled) { if (_settings.CacheSettings == null) { throw new Exception("Cache settings not set"); } var cacheAdapter = new CacheAdapter(_settings.CacheSettings.CacheName); cacheAdapter.RetryInterval = _settings.CacheSettings.ConnectionRetryInterval.HasValue ? _settings.CacheSettings.ConnectionRetryInterval.Value : 300; cacheAdapter.Load(); if (_settings.CacheSettings.Expiration == null) { throw new Exception("Expiration settings not set"); } cacheAdapter.DefaultExpiration = _settings.CacheSettings.Expiration.Convert(); cache = cacheAdapter.GetSynchronized(settingsLock); } } finally { settingsLock.ReleaseWriterLock(); } }