/// <summary>
        /// Obtiene el manejador de cache según configuración
        /// </summary>
        /// <returns>Manejador de cache configurado</returns>
        public static ICacheManager GetCache(string policyName)
        {
            ICacheManager cacheManager = null;

            CachePolicyConfiguration policyConf = CacheConfigurationManager.GetPolicyConfiguration(policyName);

            if (Cache.Instances.TryGetValue(policyConf.Name, out cacheManager) == false)
            {
                throw new CacheException(Messages.InexistentPolicyName, new ArgumentNullException());
            }

            return(cacheManager);
        }
 /// <summary>
 /// Carga la configuración a partir de <paramref name="section"/>
 /// </summary>
 /// <param name="section">Sección de configuración del archivo de configuración</param>
 private static void LoadConfigurationFromConfigurationSection(CachingSection section)
 {
     foreach (CachePolicyElement policyElement in section.PolicyCollection)
     {
         CachePolicyConfiguration policyConf = new CachePolicyConfiguration()
         {
             Name                          = policyElement.Name,
             CacheType                     = policyElement.CacheType,
             DefaultLifeTime               = policyElement.DefaultLifeTime,
             CacheMemoryLimitMegabytes     = policyElement.CacheMemoryLimitMegabytes,
             PhysicalMemoryLimitPercentage = policyElement.PhysicalMemoryLimitPercentage,
             PollingInterval               = policyElement.PollingInterval
         };
         CacheConfigurationManager._policyConfigurationList.Add(policyConf);
     }
 }
        /// <summary>
        /// Obtiene el <see cref="PolicyConfiguration"/> de la lista
        /// </summary>
        /// <param name="policyName">Nombre de la política a obtener</param>
        /// <returns>Política obtenida</returns>
        internal static CachePolicyConfiguration GetPolicyConfiguration(string policyName)
        {
            //Si el nombre de la política es vacio
            if (policyName == string.Empty)
            {
                throw new CacheException(Messages.EmptyPolicyName);
            }

            CachePolicyConfiguration policyConf = _policyConfigurationList.Find(
                cp => cp.Name == policyName);

            //Si no encuentro la política
            if (policyConf == null)
            {
                throw new CacheException(Messages.InexistentPolicyName + policyName);
            }

            return(policyConf);
        }