Documentation
¶
Index ¶
- Variables
- func PullFor[T any](ctx context.Context, app Client, key string, handler func(T, error))
- func SubscribeFor[T any](ctx context.Context, app Client, channel string, handler func(T, error)) (<-chan struct{}, func(context.Context) error)
- type App
- func (a App) Delete(ctx context.Context, keys ...string) (err error)
- func (a App) DeletePattern(ctx context.Context, pattern string) (err error)
- func (a App) Enabled() bool
- func (a App) Exclusive(ctx context.Context, name string, timeout time.Duration, ...) (acquired bool, err error)
- func (a App) Expire(ctx context.Context, ttl time.Duration, keys ...string) (err error)
- func (a App) Load(ctx context.Context, key string) (content []byte, err error)
- func (a App) LoadMany(ctx context.Context, keys ...string) ([]string, error)
- func (a App) Ping(ctx context.Context) error
- func (a App) Pipeline() redis.Pipeliner
- func (a App) Publish(ctx context.Context, channel string, value any) (err error)
- func (a App) PublishJSON(ctx context.Context, channel string, value any) error
- func (a App) Pull(ctx context.Context, key string, handler func(string, error))
- func (a App) Push(ctx context.Context, key string, value any) error
- func (a App) Scan(ctx context.Context, pattern string, output chan<- string, pageSize int64) error
- func (a App) Store(ctx context.Context, key string, value any, duration time.Duration) error
- func (a App) Subscribe(ctx context.Context, channel string) (<-chan *redis.Message, func(context.Context) error)
- type Client
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDisabled = errors.New("redis not enabled")
View Source
var ErrNoSubscriber = errors.New("no subscriber for channel")
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (App) DeletePattern ¶ added in v4.48.1
func (App) PublishJSON ¶ added in v4.52.7
type Client ¶ added in v4.52.6
type Client interface {
Enabled() bool
Ping(ctx context.Context) error
Load(ctx context.Context, key string) ([]byte, error)
LoadMany(ctx context.Context, keys ...string) ([]string, error)
Store(ctx context.Context, key string, value any, ttl time.Duration) error
Delete(ctx context.Context, keys ...string) error
DeletePattern(ctx context.Context, pattern string) error
Scan(ctx context.Context, pattern string, output chan<- string, pageSize int64) error
Exclusive(ctx context.Context, name string, timeout time.Duration, action func(context.Context) error) (bool, error)
Expire(ctx context.Context, ttl time.Duration, keys ...string) error
Push(ctx context.Context, key string, value any) error
Pull(ctx context.Context, key string, handler func(string, error))
Publish(ctx context.Context, channel string, value any) error
PublishJSON(ctx context.Context, channel string, value any) error
Subscribe(ctx context.Context, channel string) (<-chan *redis.Message, func(context.Context) error)
Pipeline() redis.Pipeliner
}
Click to show internal directories.
Click to hide internal directories.