Table of Contents

Interface ISubscriber

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

A redis connection used as the subscriber in a pub/sub scenario

public interface ISubscriber : IRedis, IRedisAsync
Inherited Members

Methods

IdentifyEndpoint(RedisChannel, CommandFlags)

Inidicate exactly which redis server we are talking to

EndPoint IdentifyEndpoint(RedisChannel channel, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
flags CommandFlags

Returns

EndPoint

IdentifyEndpointAsync(RedisChannel, CommandFlags)

Inidicate exactly which redis server we are talking to

Task<EndPoint> IdentifyEndpointAsync(RedisChannel channel, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
flags CommandFlags

Returns

Task<EndPoint>

IsConnected(RedisChannel)

Indicates whether the instance can communicate with the server; if a channel is specified, the existing subscription map is queried to resolve the server responsible for that subscription - otherwise the server is chosen aribtraily from the masters.

bool IsConnected(RedisChannel channel = default)

Parameters

channel RedisChannel

Returns

bool

Publish(RedisChannel, RedisValue, CommandFlags)

Posts a message to the given channel.

long Publish(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
message RedisValue
flags CommandFlags

Returns

long

the number of clients that received the message.

Remarks

PublishAsync(RedisChannel, RedisValue, CommandFlags)

Posts a message to the given channel.

Task<long> PublishAsync(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
message RedisValue
flags CommandFlags

Returns

Task<long>

the number of clients that received the message.

Remarks

Subscribe(RedisChannel, Action<RedisChannel, RedisValue>, CommandFlags)

Subscribe to perform some operation when a change to the preferred/active node is broadcast.

void Subscribe(RedisChannel channel, Action<RedisChannel, RedisValue> handler, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
handler Action<RedisChannel, RedisValue>
flags CommandFlags

Remarks

SubscribeAsync(RedisChannel, Action<RedisChannel, RedisValue>, CommandFlags)

Subscribe to perform some operation when a change to the preferred/active node is broadcast.

Task SubscribeAsync(RedisChannel channel, Action<RedisChannel, RedisValue> handler, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
handler Action<RedisChannel, RedisValue>
flags CommandFlags

Returns

Task

Remarks

SubscribedEndpoint(RedisChannel)

Inidicate to which redis server we are actively subscribed for a given channel; returns null if the channel is not actively subscribed

EndPoint SubscribedEndpoint(RedisChannel channel)

Parameters

channel RedisChannel

Returns

EndPoint

Unsubscribe(RedisChannel, Action<RedisChannel, RedisValue>, CommandFlags)

Unsubscribe from a specified message channel; note; if no handler is specified, the subscription is cancelled regardless of the subscribers; if a handler is specified, the subscription is only cancelled if this handler is the last handler remaining against the channel

void Unsubscribe(RedisChannel channel, Action<RedisChannel, RedisValue> handler = null, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
handler Action<RedisChannel, RedisValue>
flags CommandFlags

Remarks

UnsubscribeAll(CommandFlags)

Unsubscribe all subscriptions on this instance

void UnsubscribeAll(CommandFlags flags = CommandFlags.None)

Parameters

flags CommandFlags

Remarks

UnsubscribeAllAsync(CommandFlags)

Unsubscribe all subscriptions on this instance

Task UnsubscribeAllAsync(CommandFlags flags = CommandFlags.None)

Parameters

flags CommandFlags

Returns

Task

Remarks

UnsubscribeAsync(RedisChannel, Action<RedisChannel, RedisValue>, CommandFlags)

Unsubscribe from a specified message channel; note; if no handler is specified, the subscription is cancelled regardless of the subscribers; if a handler is specified, the subscription is only cancelled if this handler is the last handler remaining against the channel

Task UnsubscribeAsync(RedisChannel channel, Action<RedisChannel, RedisValue> handler = null, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
handler Action<RedisChannel, RedisValue>
flags CommandFlags

Returns

Task

Remarks