Пример #1
0
        /// <summary>
        /// Returns the configured <see cref="CacheType" /> or the default <see cref="T:TcmCDService.CacheTypes.NullCache" />
        /// </summary>
        /// <returns></returns>
        public static CacheType GetCacheType()
        {
            if (Config.Instance != null)
            {
                try
                {
                    CacheTypeElement cacheTypeElement = Config.Instance.CacheType;

                    Type cacheType = Type.GetType(cacheTypeElement.CacheType);

                    if (cacheType != null)
                    {
                        return((CacheType)Activator.CreateInstance(cacheType, new Settings(cacheTypeElement.Settings)));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("Error initializing CacheType", ex);
                }
            }

            // Default to standard NullCache
            return(new NullCache(null));
        }
 public void Add(CacheTypeElement customElement)
 {
     BaseAdd(customElement);
 }