5#include <unordered_map>
16template <
class TKey,
class TMap = std::unordered_map<TKey,
int64_t>>
43 auto it = _startedAt.find(
key);
44 if (
it == _startedAt.end())
75template <
class TFirst,
class TSecond>
A per-key cooldown, such as one notice per player per minute.
void RemoveExpired(int64_t nowSec, int64_t maxAgeSec)
bool TryStart(const TKey &key, int64_t nowSec, int64_t seconds)
Cooldown(int64_t seconds)
void Start(const TKey &key, int64_t nowSec)
int64_t SecondsLeft(const TKey &key, int64_t nowSec) const
int64_t SecondsLeft(const TKey &key, int64_t nowSec, int64_t seconds) const
void Reset(const TKey &key)
bool TryStart(const TKey &key, int64_t nowSec)
static std::string ReadFile(const std::filesystem::path &path)