Table of Contents

Interface IConnectionMultiplexer

Namespace
StackExchange.Redis
Assembly
StackExchange.Redis.StrongName.dll

Represents the abstract multiplexer API

public interface IConnectionMultiplexer

Properties

ClientName

Gets the client-name that will be used on all new connections

string ClientName { get; }

Property Value

string

Configuration

Gets the configuration of the connection

string Configuration { get; }

Property Value

string

IncludeDetailInExceptions

Should exceptions include identifiable details? (key names, additional .Data annotations)

bool IncludeDetailInExceptions { get; set; }

Property Value

bool

IsConnected

Indicates whether any servers are connected

bool IsConnected { get; }

Property Value

bool

OperationCount

The number of operations that have been performed on all connections

long OperationCount { get; }

Property Value

long

PreserveAsyncOrder

Gets or sets whether asynchronous operations should be invoked in a way that guarantees their original delivery order

bool PreserveAsyncOrder { get; set; }

Property Value

bool

StormLogThreshold

Limit at which to start recording unusual busy patterns (only one log will be retained at a time; set to a negative value to disable this feature)

int StormLogThreshold { get; set; }

Property Value

int

TimeoutMilliseconds

Gets the timeout associated with the connections

int TimeoutMilliseconds { get; }

Property Value

int

Methods

BeginProfiling(object)

Begins profiling for the given context.

If the same context object is returned by the registered IProfiler, the IProfiledCommands will be associated with each other.

Call FinishProfiling with the same context to get the assocated commands.

Note that forContext cannot be a WeakReference or a WeakReference<T>

void BeginProfiling(object forContext)

Parameters

forContext object

Close(bool)

Close all connections and release all resources associated with this object

void Close(bool allowCommandsToComplete = true)

Parameters

allowCommandsToComplete bool

CloseAsync(bool)

Close all connections and release all resources associated with this object

Task CloseAsync(bool allowCommandsToComplete = true)

Parameters

allowCommandsToComplete bool

Returns

Task

Configure(TextWriter)

Reconfigure the current connections based on the existing configuration

bool Configure(TextWriter log = null)

Parameters

log TextWriter

Returns

bool

ConfigureAsync(TextWriter)

Reconfigure the current connections based on the existing configuration

Task<bool> ConfigureAsync(TextWriter log = null)

Parameters

log TextWriter

Returns

Task<bool>

Dispose()

Release all resources associated with this object

void Dispose()

FinishProfiling(object, bool)

Stops profiling for the given context, returns all IProfiledCommands associated.

By default this may do a sweep for dead profiling contexts, you can disable this by passing "allowCleanupSweep: false".

ProfiledCommandEnumerable FinishProfiling(object forContext, bool allowCleanupSweep = true)

Parameters

forContext object
allowCleanupSweep bool

Returns

ProfiledCommandEnumerable

GetCounters()

Get summary statistics associates with this server

ServerCounters GetCounters()

Returns

ServerCounters

GetDatabase(int, object)

Obtain an interactive connection to a database inside redis

IDatabase GetDatabase(int db = -1, object asyncState = null)

Parameters

db int
asyncState object

Returns

IDatabase

GetEndPoints(bool)

Gets all endpoints defined on the server

EndPoint[] GetEndPoints(bool configuredOnly = false)

Parameters

configuredOnly bool

Returns

EndPoint[]

GetServer(EndPoint, object)

Obtain a configuration API for an individual server

IServer GetServer(EndPoint endpoint, object asyncState = null)

Parameters

endpoint EndPoint
asyncState object

Returns

IServer

GetServer(IPAddress, int)

Obtain a configuration API for an individual server

IServer GetServer(IPAddress host, int port)

Parameters

host IPAddress
port int

Returns

IServer

GetServer(string, int, object)

Obtain a configuration API for an individual server

IServer GetServer(string host, int port, object asyncState = null)

Parameters

host string
port int
asyncState object

Returns

IServer

GetServer(string, object)

Obtain a configuration API for an individual server

IServer GetServer(string hostAndPort, object asyncState = null)

Parameters

hostAndPort string
asyncState object

Returns

IServer

GetStatus()

Provides a text overview of the status of all connections

string GetStatus()

Returns

string

GetStatus(TextWriter)

Provides a text overview of the status of all connections

void GetStatus(TextWriter log)

Parameters

log TextWriter

GetStormLog()

Obtains the log of unusual busy patterns

string GetStormLog()

Returns

string

GetSubscriber(object)

Obtain a pub/sub subscriber connection to the specified server

ISubscriber GetSubscriber(object asyncState = null)

Parameters

asyncState object

Returns

ISubscriber

HashSlot(RedisKey)

Compute the hash-slot of a specified key

int HashSlot(RedisKey key)

Parameters

key RedisKey

Returns

int

PublishReconfigure(CommandFlags)

Request all compatible clients to reconfigure or reconnect

long PublishReconfigure(CommandFlags flags = CommandFlags.None)

Parameters

flags CommandFlags

Returns

long

The number of instances known to have received the message (however, the actual number can be higher; returns -1 if the operation is pending)

PublishReconfigureAsync(CommandFlags)

Request all compatible clients to reconfigure or reconnect

Task<long> PublishReconfigureAsync(CommandFlags flags = CommandFlags.None)

Parameters

flags CommandFlags

Returns

Task<long>

The number of instances known to have received the message (however, the actual number can be higher)

RegisterProfiler(IProfiler)

Sets an IProfiler instance for this ConnectionMultiplexer.

An IProfiler instances is used to determine which context to associate an IProfiledCommand with. See BeginProfiling(object) and FinishProfiling(object) for more details.

void RegisterProfiler(IProfiler profiler)

Parameters

profiler IProfiler

ResetStormLog()

Resets the log of unusual busy patterns

void ResetStormLog()

ToString()

See Object.ToString()

string ToString()

Returns

string

Wait(Task)

Wait for a given asynchronous operation to complete (or timeout)

void Wait(Task task)

Parameters

task Task

WaitAll(params Task[])

Wait for the given asynchronous operations to complete (or timeout)

void WaitAll(params Task[] tasks)

Parameters

tasks Task[]

Wait<T>(Task<T>)

Wait for a given asynchronous operation to complete (or timeout)

T Wait<T>(Task<T> task)

Parameters

task Task<T>

Returns

T

Type Parameters

T

Events

ConfigurationChanged

Raised when configuration changes are detected

event EventHandler<EndPointEventArgs> ConfigurationChanged

Event Type

EventHandler<EndPointEventArgs>

ConfigurationChangedBroadcast

Raised when nodes are explicitly requested to reconfigure via broadcast; this usually means master/slave changes

event EventHandler<EndPointEventArgs> ConfigurationChangedBroadcast

Event Type

EventHandler<EndPointEventArgs>

ConnectionFailed

Raised whenever a physical connection fails

event EventHandler<ConnectionFailedEventArgs> ConnectionFailed

Event Type

EventHandler<ConnectionFailedEventArgs>

ConnectionRestored

Raised whenever a physical connection is established

event EventHandler<ConnectionFailedEventArgs> ConnectionRestored

Event Type

EventHandler<ConnectionFailedEventArgs>

ErrorMessage

A server replied with an error message;

event EventHandler<RedisErrorEventArgs> ErrorMessage

Event Type

EventHandler<RedisErrorEventArgs>

HashSlotMoved

Raised when a hash-slot has been relocated

event EventHandler<HashSlotMovedEventArgs> HashSlotMoved

Event Type

EventHandler<HashSlotMovedEventArgs>

InternalError

Raised whenever an internal error occurs (this is primarily for debugging)

event EventHandler<InternalErrorEventArgs> InternalError

Event Type

EventHandler<InternalErrorEventArgs>