Documentation
¶
Overview ¶
Package memory supplies an explicit single-process lockout authority. It is useful for tests and local applications; it is never a Redis failure fallback.
Index ¶
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) LockoutBegin(ctx context.Context, key lockout.Key, policy lockout.Policy, ...) (lockout.Admission, error)
- func (b *Backend) LockoutFinish(ctx context.Context, key lockout.Key, policy lockout.Policy, ...) (lockout.Decision, error)
- func (b *Backend) LockoutReset(ctx context.Context, key lockout.Key, policy lockout.Policy) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a mutex-protected, bounded process-local lockout authority.
func (*Backend) Close ¶
Close seals the backend and clears its retained lockout entries under its mutex.
func (*Backend) LockoutBegin ¶
func (b *Backend) LockoutBegin(ctx context.Context, key lockout.Key, policy lockout.Policy, candidate lockout.Generation) (lockout.Admission, error)
LockoutBegin atomically checks the lock and returns the current snapshot for an allowed attempt.
func (*Backend) LockoutFinish ¶
func (b *Backend) LockoutFinish(ctx context.Context, key lockout.Key, policy lockout.Policy, snapshot lockout.Snapshot, outcome lockout.Outcome) (lockout.Decision, error)
LockoutFinish atomically applies an admitted outcome; stale successes cannot clear newer failures, and expired generations do not mutate current state.
Click to show internal directories.
Click to hide internal directories.