Files
base/pkg/locker/interface.go
2026-04-10 18:25:21 +03:30

13 lines
299 B
Go

package locker
import (
"context"
"time"
)
type Locker interface {
Lock(ctx context.Context, id string, ttl time.Duration) (bool, error)
Unlock(ctx context.Context, id string) error
WithLock(ctx context.Context, lockKey string, lockTime time.Duration, fn func(context.Context) error) error
}