Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion stampede.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ const (
DefaultCacheTTL = 1 * time.Minute
)

func NewStampede[V any](logger *slog.Logger, cache cachestore.Store[V], options ...Option) *stampede[V] {
type Stampede[V any] interface {
SetOptions(options *Options)
Do(ctx context.Context, key string, fn func() (V, *time.Duration, error), options ...Option) (V, error)
}

func NewStampede[V any](logger *slog.Logger, cache cachestore.Store[V], options ...Option) Stampede[V] {
opts := &Options{}
for _, o := range options {
o(opts)
Expand Down
Loading