Interface ICooldownTracker
- Namespace
- Signal.Application.Commands.Preconditions
- Assembly
- Signal.Application.dll
Stores cooldown expirations. Replace it (e.g. with a distributed cache) when running several bot instances.
public interface ICooldownTracker
Methods
TryEnter(string, TimeSpan, out TimeSpan)
Starts a cooldown for key unless one is active.
bool TryEnter(string key, TimeSpan period, out TimeSpan remaining)
Parameters
keystringThe cooldown key (command, scope and scope identifier).
periodTimeSpanThe cooldown length.
remainingTimeSpanThe remaining time when the method returns false.