RateCounter
Include fastly/erl.h to use this class.
A rate counter that can be used with an edge rate limiter or stand alone for counting and rate calculations
Constructor
explicit fastly::erl::RateCounter::RateCounter(std::string name)Parameters
- name: std::string
Methods
increment
View sourcetl::expected<void, ERLError> fastly::erl::RateCounter::increment(std::string_view entry, std::uint32_t delta)Increment an entry in the ratecounter by delta.
Parameters
- entry: std::string_view
- delta: std::uint32_t
Returns
tl::expected<void, ERLError>
lookup_count
View sourcetl::expected<std::uint32_t, ERLError> fastly::erl::RateCounter::lookup_count(std::string_view entry, CounterDuration duration) constLookup the current count for entry in the rate counter for a duration.
Parameters
- entry: std::string_view
- duration: CounterDuration
Returns
tl::expected<std::uint32_t, ERLError>
lookup_rate
View sourcetl::expected<std::uint32_t, ERLError> fastly::erl::RateCounter::lookup_rate(std::string_view entry, RateWindow window) constLookup the current rate for entry in the rate counter for a window.
Parameters
- entry: std::string_view
- window: RateWindow
Returns
tl::expected<std::uint32_t, ERLError>