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

    Class RedisConfigurationBuilder

    RedisConfigurationBuilder helps creating the RedisConfiguration object via code.

    Inheritance
    Object
    RedisConfigurationBuilder
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace:CacheManager.Redis
    Assembly:CacheManager.StackExchange.Redis.dll
    Syntax
    public class RedisConfigurationBuilder

    Constructors

    | Improve this Doc View Source

    RedisConfigurationBuilder(String)

    Initializes a new instance of the RedisConfigurationBuilder class.

    Declaration
    public RedisConfigurationBuilder(string configurationKey)
    Parameters
    Type Name Description
    String configurationKey

    The configuration key.

    Exceptions
    Type Condition
    ArgumentNullException

    If configurationKey is null.

    Methods

    | Improve this Doc View Source

    Build()

    Creates the RedisConfiguration out of the currently specified properties, if possible.

    Declaration
    public RedisConfiguration Build()
    Returns
    Type Description
    RedisConfiguration

    The RedisConfiguration

    | Improve this Doc View Source

    EnableKeyspaceEvents()

    Enable the flag to have CacheManager react on keyspace notifications from redis. CacheManager will listen only for eviction and expiration events (not all events). Use this feature only if you also have configured Redis correctly: notify-keyspace-events must be set to AT LEAST Exe. https://redis.io/topics/notifications#configuration

    Declaration
    public RedisConfigurationBuilder EnableKeyspaceEvents()
    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    UseCompatibilityMode(String)

    Can be used to control the available Redis features CacheManager can use. E.g. if set to "2.4", this would disable all LUA support and would force CacheManager to use other APIs

    Declaration
    public RedisConfigurationBuilder UseCompatibilityMode(string version)
    Parameters
    Type Name Description
    String version
    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    UseTwemproxy()

    Enable this in case you are using Redis behind Twemproxy.

    Declaration
    [CLSCompliant(false)]
    public RedisConfigurationBuilder UseTwemproxy()
    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithAllowAdmin()

    If set to true, commands which might be risky are enabled, like Clear which will delete all entries in the redis database.

    Declaration
    public RedisConfigurationBuilder WithAllowAdmin()
    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithConnectionTimeout(Int32)

    Sets the timeout in milliseconds for connect operations.

    Declaration
    public RedisConfigurationBuilder WithConnectionTimeout(int timeout)
    Parameters
    Type Name Description
    Int32 timeout

    The timeout in milliseconds.

    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithDatabase(Int32)

    Sets the database.

    Maximum number of database depends on the redis server configuration.

    Default is 0.

    Declaration
    public RedisConfigurationBuilder WithDatabase(int databaseIndex)
    Parameters
    Type Name Description
    Int32 databaseIndex

    The database index.

    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithEndpoint(String, Int32)

    Adds an endpoint to the connection configuration.

    Call this multiple times to add multiple endpoints.

    Declaration
    public RedisConfigurationBuilder WithEndpoint(string host, int port)
    Parameters
    Type Name Description
    String host

    The host or IP of the redis server.

    Int32 port

    The port of the redis server.

    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithPassword(String)

    Sets the password for the redis server.

    Declaration
    public RedisConfigurationBuilder WithPassword(string serverPassword)
    Parameters
    Type Name Description
    String serverPassword

    The redis server password.

    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

    | Improve this Doc View Source

    WithSsl(String)

    Enables SSL encryption.

    If host is specified it will enforce a particular SSL host identity on the server's certificate.

    Declaration
    public RedisConfigurationBuilder WithSsl(string host = null)
    Parameters
    Type Name Description
    String host

    The SSL host.

    Returns
    Type Description
    RedisConfigurationBuilder

    The builder.

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