deduplicator

package
v0.0.0-...-4318582 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deduplicator

type Deduplicator struct {
	// contains filtered or unexported fields
}

Deduplicator represents a filter to avoid duplicate messages

func New

func New(cache cache.CacheInterface[bool], logger *zap.Logger, opts ...Option) *Deduplicator

New creates a deduplicator instance

func (*Deduplicator) Apply

func (d *Deduplicator) Apply(ctx context.Context, key string, fn func() error) error

Apply executes the fn function in case the message has not been received previously

type Option

type Option func(*Deduplicator)

Option represents a deduplicator option function.

func WithExpiration

func WithExpiration(expiration time.Duration) Option

WithExpiration allows to specify an expiration time when setting a value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL