Documentation ¶
Index ¶
- Variables
- func PullFor[T any](ctx context.Context, client Client, key string, handler func(T, error))
- func SubscribeFor[T any](ctx context.Context, client Subscriber, channel string, handler func(T, error))
- type Client
- type Config
- type Noop
- func (n Noop) Close(_ context.Context)
- 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) StoreMany(_ context.Context, _ map[string]any, _ time.Duration) error
- func (n Noop) Subscribe(_ context.Context, _ string) (<-chan *redis.Message, func(context.Context))
- type Service
- func (s *Service) Close(ctx context.Context)
- func (s *Service) Delete(ctx context.Context, keys ...string) (err error)
- func (s *Service) DeletePattern(ctx context.Context, pattern string) (err error)
- func (s *Service) Enabled() bool
- func (s *Service) Exclusive(ctx context.Context, name string, timeout time.Duration, ...) (acquired bool, err error)
- func (s *Service) Expire(ctx context.Context, ttl time.Duration, keys ...string) error
- func (s *Service) FlushAll(ctx context.Context) error
- func (s *Service) Load(ctx context.Context, key string) ([]byte, error)
- func (s *Service) LoadMany(ctx context.Context, keys ...string) ([]string, error)
- func (s *Service) Ping(ctx context.Context) error
- func (s *Service) Pipeline() redis.Pipeliner
- func (s Service) Publish(ctx context.Context, channel string, value any) (err error)
- func (s Service) PublishJSON(ctx context.Context, channel string, value any) error
- func (s Service) Pull(ctx context.Context, key string, handler func(string, error))
- func (s Service) Push(ctx context.Context, key string, value any) error
- func (s *Service) Scan(ctx context.Context, pattern string, output chan<- string, pageSize int64) error
- func (s *Service) Store(ctx context.Context, key string, value any, ttl time.Duration) error
- func (s *Service) StoreMany(ctx context.Context, values map[string]any, ttl time.Duration) error
- func (s Service) Subscribe(ctx context.Context, channel string) (<-chan *redis.Message, func(context.Context))
- type Subscriber
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 ¶
func SubscribeFor ¶ added in v4.44.0
Types ¶
type Client ¶ added in v4.52.6
type Client interface { Subscriber Enabled() bool Close(context.Context) 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 StoreMany(ctx context.Context, values map[string]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 Pipeline() redis.Pipeliner }
type Config ¶
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
type Service ¶ added in v4.64.0
type Service struct {
// contains filtered or unexported fields
}
func (*Service) DeletePattern ¶ added in v4.64.0
func (Service) PublishJSON ¶ added in v4.64.0
Click to show internal directories.
Click to hide internal directories.