protected virtual void LoadConfig()
        {
            var configuration = CacheConfigurationSection.GetSection();

            if (configuration == null)
            {
                configuration        = new CacheConfigurationSection();
                configuration.Caches = new CacheElementCollection();
                configuration.Caches.Add(new CacheElement()
                {
                    Default = true, RegionName = "spr_region_default", Type = typeof(LocalCache)
                });
            }

            LoadConfig(configuration);
        }
        public virtual void LoadConfig(CacheConfigurationSection configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            var defaultElement = configuration.Caches.Cast <CacheElement>().FirstOrDefault(x => x.Default);

            if (defaultElement != null)
            {
                DefaultRegionName = defaultElement.RegionName;
            }

            foreach (CacheElement element in configuration.Caches)
            {
                SetCache(element.RegionName, element.Type, element.ConnectionString, element.Default);
            }
        }
 public CacheSettings(CacheConfigurationSection configuration)
     : this()
 {
     LoadConfig(configuration);
 }