• CacheManager
  • Documentation
  • Api Docs
  • MichaCo.net
    Show / Hide Table of Contents

    Class MicrosoftConfigurationExtensions

    Extensions for the Microsoft configuration framework to load CacheManagerConfigurations.

    Inheritance
    Object
    MicrosoftConfigurationExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace:Microsoft.Extensions.Configuration
    Assembly:CacheManager.Microsoft.Extensions.Configuration.dll
    Syntax
    public static class MicrosoftConfigurationExtensions

    Methods

    | Improve this Doc View Source

    GetCacheConfiguration(IConfiguration)

    Gets the first and only CacheManagerConfiguration defined in the

    cacheManagers
    section of the provided configuration.

    Declaration
    public static ICacheManagerConfiguration GetCacheConfiguration(this IConfiguration configuration)
    Parameters
    Type Name Description
    Microsoft.Extensions.Configuration.IConfiguration configuration

    The source configuration.

    Returns
    Type Description
    ICacheManagerConfiguration

    The .

    Exceptions
    Type Condition
    InvalidOperationException

    If no cacheManagers section is defined or more than one manager is configured.

    | Improve this Doc View Source

    GetCacheConfiguration(IConfiguration, String)

    Retrieve a CacheManagerConfiguration defined in the

    cacheManagers
    section of the provided configuration by name.

    Declaration
    public static ICacheManagerConfiguration GetCacheConfiguration(this IConfiguration configuration, string name)
    Parameters
    Type Name Description
    Microsoft.Extensions.Configuration.IConfiguration configuration

    The source configuration.

    String name

    The name of the cache.

    Returns
    Type Description
    ICacheManagerConfiguration

    The ICacheManagerConfiguration.

    Exceptions
    Type Condition
    ArgumentNullException

    If either configuration or name is null.

    InvalidOperationException

    If no

    cacheManagers
    section is defined in the configuration, or if no configuration was found for the name.

    | Improve this Doc View Source

    GetCacheConfigurations(IConfiguration)

    Retrieves all configured CacheManagerConfigurations defined in the

    cacheManagers
    section of the provided configuration.

    Declaration
    public static IEnumerable<ICacheManagerConfiguration> GetCacheConfigurations(this IConfiguration configuration)
    Parameters
    Type Name Description
    Microsoft.Extensions.Configuration.IConfiguration configuration

    The source configuration.

    Returns
    Type Description
    IEnumerable<ICacheManagerConfiguration>

    The list of ICacheManagerConfigurations.

    Exceptions
    Type Condition
    InvalidOperationException

    If no

    cacheManagers
    section is defined.

    | Improve this Doc View Source

    LoadRedisConfigurations(IConfiguration)

    Loads all available Redis configurations from the the

    redis
    section of the provided configuration.

    Declaration
    public static void LoadRedisConfigurations(this IConfiguration configuration)
    Parameters
    Type Name Description
    Microsoft.Extensions.Configuration.IConfiguration configuration

    The source configuration.

    Remarks

    This method always gets invoked by GetCacheConfiguration(IConfiguration) or the other overloads. You do not have to call this explicitly. The method also does not throw an exception if the

    redis
    section is not defined.

    Exceptions
    Type Condition
    InvalidOperationException

    If the CacheManager.StackExchange.Redis package is not installed.

    • Improve this Doc
    • View Source
    © 2025 by Michael Conrad. All rights reserved. - MichaCo.net