basalt / auth/src / MemoryThrottleStore
Class: MemoryThrottleStore
Defined in: auth/src/throttle.ts:77
In-process ThrottleStore (the default): synchronous and bounded.
Implements
Constructors
Constructor
> new MemoryThrottleStore(options?): MemoryThrottleStore
Defined in: auth/src/throttle.ts:82
Parameters
options?
MemoryThrottleStoreOptions = {}
Returns
MemoryThrottleStore
Accessors
size
Get Signature
> get size(): number
Defined in: auth/src/throttle.ts:88
Number of keys currently tracked.
Returns
number
Methods
hit()
> hit(key, windowMs, limit?): ThrottleWindow
Defined in: auth/src/throttle.ts:127
Atomically counts one attempt and returns the new state. The first hit of a key opens a fixed window of windowMs; later hits do not extend it.
limit is the caller's budget: once count >= limit the key is locked. A bounded store uses it to keep locked keys over unlocked ones when it has to evict; stores without eviction may ignore it.
Parameters
key
string
windowMs
number
limit?
number
Returns
Implementation of
peek()
> peek(key): ThrottleWindow | null
Defined in: auth/src/throttle.ts:136
The current state without counting; null when the key has no live window.
Parameters
key
string
Returns
ThrottleWindow | null
Implementation of
release()
> release(key): void
Defined in: auth/src/throttle.ts:142
Gives one attempt back (a successful attempt must not consume budget).
Parameters
key
string
Returns
void
Implementation of
reset()
> reset(key): void
Defined in: auth/src/throttle.ts:149
Forgets the key.
Parameters
key
string
Returns
void
Implementation of
retainedKeyChars()
> retainedKeyChars(): number
Defined in: auth/src/throttle.ts:93
Total characters retained in keys — diagnostics for memory bounds.
Returns
number