Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct { RedisURL string MaxOpenConnection *int MaxIdleConnection *int IdleConnectionTimeout *config.DurationSeconds MaxConnectionLifetime *config.DurationSeconds }
func (*ConnectionOptions) ConnKey ¶
func (c *ConnectionOptions) ConnKey() string
type Handle ¶
type Handle struct { ConnectionOptions ConnectionOptions // contains filtered or unexported fields }
func NewHandle ¶
func NewHandle(pool *Pool, connectionOptions ConnectionOptions, logger *log.Logger) *Handle
func (*Handle) WithConnContext ¶
type Hub ¶
type Hub struct { Pool *Pool Logger *log.Logger SubscriberID *SubscriberID PubSub map[string]*PubSub // Mailbox handles 3 messages. // This mailbox is never closed. Mailbox chan interface{} }
Hub aims to multiplex multiple subscription to Redis PubSub channel over a single connection.
func (*Hub) Subscribe ¶
func (h *Hub) Subscribe( ConnectionOptions *ConnectionOptions, channelName string, ) Subscription
type HubMessagePubSubCancel ¶
type HubMessagePubSubDead ¶
type HubMessagePubSubDead struct {
ConnKey string
}
type HubMessageSubscribe ¶
type HubMessageSubscribe struct { ConnectionOptions *ConnectionOptions ChannelName string Result chan Subscription }
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) Client ¶
func (p *Pool) Client(connectionOptions *ConnectionOptions) *redis.Client
type PubSub ¶
type PubSub struct { ConnKey string SupervisorMailbox chan interface{} Logger *log.Logger PubSub *redis.PubSub Subscriber map[string][]Subscriber // Mailbox handles 3 messages. // 1. When the mailbox is closed, that means the actor should die. // 2. PubSubMessageJoin // 3. PubSubMessageLeave Mailbox chan interface{} }
PubSub is an actor wrapping redis.PubSub
type PubSubMessageJoin ¶
type PubSubMessageJoin Subscriber
PubSubMessageJoin is essentially Subscriber.
type PubSubMessageLeave ¶
PubSubMessageLeave is basically Subscriber without MessageChannel.
type Redis_6_0_Cmdable ¶
type Redis_6_0_Cmdable interface { Del(ctx context.Context, keys ...string) *goredis.IntCmd Get(ctx context.Context, key string) *goredis.StringCmd Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *goredis.StatusCmd SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *goredis.StatusCmd SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *goredis.BoolCmd SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *goredis.BoolCmd Expire(ctx context.Context, key string, expiration time.Duration) *goredis.BoolCmd ExpireAt(ctx context.Context, key string, tm time.Time) *goredis.BoolCmd Incr(ctx context.Context, key string) *goredis.IntCmd IncrBy(ctx context.Context, key string, value int64) *goredis.IntCmd PExpireAt(ctx context.Context, key string, tm time.Time) *goredis.BoolCmd XAdd(ctx context.Context, a *goredis.XAddArgs) *goredis.StringCmd HDel(ctx context.Context, key string, fields ...string) *goredis.IntCmd HSet(ctx context.Context, key string, values ...interface{}) *goredis.IntCmd HGetAll(ctx context.Context, key string) *goredis.MapStringStringCmd LPush(ctx context.Context, key string, values ...interface{}) *goredis.IntCmd BRPop(ctx context.Context, timeout time.Duration, keys ...string) *goredis.StringSliceCmd // HyperLogLog. PFCount(ctx context.Context, keys ...string) *goredis.IntCmd PFAdd(ctx context.Context, key string, els ...interface{}) *goredis.IntCmd // For lua script Eval(ctx context.Context, script string, keys []string, args ...interface{}) *goredis.Cmd EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *goredis.Cmd EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *goredis.Cmd EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *goredis.Cmd ScriptExists(ctx context.Context, hashes ...string) *goredis.BoolSliceCmd ScriptLoad(ctx context.Context, script string) *goredis.StringCmd }
type Subscriber ¶
type Subscriber struct { ChannelName string SubscriberID int64 // The drop pattern // See https://www.ardanlabs.com/blog/2017/10/the-behavior-of-channels.html MessageChannel chan *redis.Message }
type SubscriberID ¶
type SubscriberID struct {
Counter int64
}
func (*SubscriberID) Next ¶
func (i *SubscriberID) Next() int64
type Subscription ¶
type Subscription struct { MessageChannel chan *redis.Message Cancel func() }
Click to show internal directories.
Click to hide internal directories.