Execute a Task limiting the times it can be executed following a strategy.
More...
#include <ratelimiter.hpp>
|
| | Ratelimiter (std::unique_ptr< Strategy > strategy) |
| | Construct a Ratelimiter with the provided strategy. More...
|
| |
| template<typename Callable , typename... Args> |
| return_type_t< Callable, Args... > | execute (Callable &&callable, Args &&...args) |
| | Execute the task, using the strategy to ensure that the rate limit is satisfied. More...
|
| |
template<typename Strategy>
class resilient::Ratelimiter< Strategy >
Execute a Task limiting the times it can be executed following a strategy.
A rate limiter distributes executions over time to guarantee that they stay below a specific rate. Ratelimiter uses a strategy, which is an implementation of a rate limiting algorithm, to execute the provided Task.
- Template Parameters
-
template<typename Strategy >
Construct a Ratelimiter with the provided strategy.
- Parameters
-
| strategy | A pointer to the strategy to use. |
template<typename Strategy >
template<typename Callable , typename... Args>
Execute the task, using the strategy to ensure that the rate limit is satisfied.
- Parameters
-
| callable | The task to execute |
| args... | The arguments to the task |
- Returns
- The result of invoking the task with the arguments
The documentation for this class was generated from the following file:
- include/resilient/policy/ratelimiter.hpp