/// <summary> /// Used by derived types to initialize a new instance based on configuration data. /// </summary> /// <param name="cache">The <see cref="ObjectCache"/> collection to work with.</param> /// <param name="configurationName">The name of the configuration settings item to use if available.</param> protected CacheBase(ObjectCache cache, string configurationName) { _Cache = cache; CacheConfigurationElement cacheConfiguration = CacheConfigurationSection.GetConfiguration(configurationName); if (cacheConfiguration == null) { _Options = new CacheOptions(); } else { _Options.RemovalResponse = cacheConfiguration.RemovalResponse; _Options.Expiration = cacheConfiguration.ExpirationMode; _Options.CacheDuration = cacheConfiguration.CacheDuration; _Options.Priority = cacheConfiguration.Priority; } }
/// <summary> /// Used by derived types to initialize a new instance. /// </summary> /// <param name="cache">The <see cref="ObjectCache"/> collection to work with.</param> /// <param name="options">An object representing caching options.</param> protected CacheBase(ObjectCache cache, CacheOptions options) { _Cache = cache; _Options = options ?? new CacheOptions(); }