/// <summary>
 /// Construct the ICacheProvider implementation using the configuration provided, the
 /// logging implementation provided, and the cache adapter resolver provided. If
 /// any of these items are passed as null, the existing values/settings are used. If there
 /// are no existing settings, then the default implementation is used.
 /// </summary>
 /// <param name="config">Configuration to use when creating the cache engine. if NULL
 /// is passed in, then the configuration is created based on values in the configuration file.</param>
 /// <param name="logger">The logging implementation to use. If NULL is provided, then the
 /// generic logging implementation is used.</param>
 /// <param name="resolver">The CacheAdapter resolver to use. If NULL is provided, the
 /// default resolver is used. You would typically provided your own resolver if you
 /// wanted to use different dependency resolution engines such as Ninject or Autofac which
 /// provide much richer lifetime support.</param>
 /// <returns></returns>
 public static ICacheProvider ResolveCacheFromConfig(CacheConfig config, ILogging logger = null, ICacheAdapterResolver resolver = null)
 {
     _config   = config;
     _logger   = logger;
     _resolver = resolver;
     EnsureObjectPropertiesAreValidObjects();
     return(_resolver.ResolveCacheFromConfig(_config));
 }
Example #2
0
        public static ICacheProvider ResolveCacheFromConfig(ILogging logger, string cacheConfigEntry = null, string dependencyManagerConfigEntry = null)
        {
            if (logger != null)
            {
                _logger = logger;
            }
            EnsureObjectPropertiesAreValidObjects();

            if (!string.IsNullOrWhiteSpace(cacheConfigEntry))
            {
                _config.CacheToUse = cacheConfigEntry;
            }
            if (!string.IsNullOrWhiteSpace(dependencyManagerConfigEntry))
            {
                _config.DependencyManagerToUse = dependencyManagerConfigEntry;
            }

            return(_resolver.ResolveCacheFromConfig(_config));
        }