Documentation
¶
Overview ¶
Path: nexss/auth/security/dlock/memory_mutex.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLocked = xerr.Conflict("resource is currently locked by another instance")
ErrLocked is returned when another instance is already processing the task.
Functions ¶
Types ¶
type MemoryMutex ¶
type MemoryMutex struct {
// contains filtered or unexported fields
}
MemoryMutex provides an in-memory implementation of Mutex for single-node / testing.
func NewMemoryMutex ¶
func NewMemoryMutex() *MemoryMutex
type Mutex ¶
type Mutex interface {
TryLock(ctx context.Context, key string, ttl time.Duration) (bool, error)
Unlock(ctx context.Context, key string) error
}
Mutex defines a distributed lock interface (e.g., Redis, NATS, Postgres).
type RedisMutex ¶
type RedisMutex struct {
// contains filtered or unexported fields
}
RedisMutex implements action.Mutex using Redis SET with NX option.
func NewRedisMutex ¶
func NewRedisMutex(client *redis.Client) *RedisMutex