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) Close()
- 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) error
- func (a *App) FlushAll(ctx context.Context) error
- func (a *App) Load(ctx context.Context, key string) ([]byte, 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
- type Noop
- func (n Noop) Close()
- func (n Noop) Delete(_ context.Context, _ ...string) error
- func (n Noop) DeletePattern(_ context.Context, _ string) error
- func (n Noop) Enabled() bool
- func (n Noop) Exclusive(_ context.Context, _ string, _ time.Duration, _ func(context.Context) error) (bool, error)
- func (n Noop) Expire(_ context.Context, _ time.Duration, _ ...string) error
- func (n Noop) FlushAll(_ context.Context) error
- func (n Noop) Load(_ context.Context, _ string) ([]byte, error)
- func (n Noop) LoadMany(_ context.Context, keys ...string) ([]string, error)
- func (n Noop) Ping(_ context.Context) error
- func (n Noop) Pipeline() redis.Pipeliner
- func (n Noop) Publish(_ context.Context, _ string, _ any) error
- func (n Noop) PublishJSON(_ context.Context, _ string, _ any) error
- func (n Noop) Pull(_ context.Context, _ string, _ func(string, error))
- func (n Noop) Push(_ context.Context, _ string, _ any) error
- func (n Noop) Scan(_ context.Context, _ string, output chan<- string, _ int64) error
- func (n Noop) Store(_ context.Context, _ string, _ any, _ time.Duration) error
- func (n Noop) Subscribe(_ context.Context, _ string) (<-chan *redis.Message, func(context.Context) error)
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 Close() FlushAll(context.Context) error 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 }
func New ¶
func New(config Config, meter metric.MeterProvider, tracer trace.TracerProvider) (Client, error)
type Noop ¶ added in v4.60.0
type Noop struct{}
func (Noop) DeletePattern ¶ added in v4.60.0
func (Noop) PublishJSON ¶ added in v4.60.0
Click to show internal directories.
Click to hide internal directories.