Rate-limit some actions.
More...
#include <Ratelimit.h>
|
|
using | Clock = std::chrono::steady_clock |
| | Clock used for measuring.
|
|
| | Ratelimit (const std::chrono::milliseconds &dur) |
| | Construct new Ratelimit, allowing action to be once per dur.
|
|
void | reset () |
| | Start counting from now.
|
| bool | limit () |
| | Limit actions to one per constructor's dur.
|
◆ Ratelimit()
| SlHelpers::Ratelimit::Ratelimit |
( |
const std::chrono::milliseconds & | dur | ) |
|
|
inline |
Construct new Ratelimit, allowing action to be once per dur.
- Parameters
-
| dur | Duration between actions |
◆ limit()
| bool SlHelpers::Ratelimit::limit |
( |
| ) |
|
|
inline |
Limit actions to one per constructor's dur.
- Returns
- true if the ratelimited action should be performed
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9-build/slhelpers-20260428.f233ce9/include/helpers/Ratelimit.h