private CacheConfiguration ReadCacheConfiguration(IConfigurationSection section)
        {
            var expirySection = section.GetSection("expiry");
            CacheExpirySettings cacheExpirySettings = CacheExpirySettings.Default;

            if (expirySection.Exists())
            {
                cacheExpirySettings = ReadExpirySection(expirySection);
            }

            bool enabled            = CacheConfiguration.Default.Enabled;
            var  enabledConfigValue = section.GetSection("enabled").Value;

            if (enabledConfigValue != null)
            {
                if (!bool.TryParse(enabledConfigValue.ToLower(), out enabled))
                {
                    throw new InvalidOperationException($"Unable to read the 'enabled' property => '{section.Path}'");
                }
            }

            bool encrypted            = CacheConfiguration.Default.Encrypted;
            var  encryptedConfigValue = section.GetSection("encrypted").Value;

            if (encryptedConfigValue != null)
            {
                if (!bool.TryParse(encryptedConfigValue.ToLower(), out encrypted))
                {
                    throw new InvalidOperationException($"Unable to read the 'encrypted' property => '{section.Path}'");
                }
            }

            return(new CacheConfiguration(cacheExpirySettings, enabled, encrypted));
        }
 public CacheConfiguration(CacheExpirySettings expiry, bool enabled = true, bool encrypted = false)
 {
     Expiry    = expiry ?? throw new ArgumentNullException(nameof(expiry));
     Enabled   = enabled;
     Encrypted = encrypted;
 }