PenaltyBox

Classin erlcompute-sdk-cpp 0.7.0View source

Include fastly/erl.h to use this class.

A penalty box that can be used with the edge rate limiter or stand alone for adding and checking if some entry is in the data set.

Constructor

explicit fastly::erl::PenaltyBox::PenaltyBox(std::string name)

Parameters

name: std::string

Methods

tl::expected<void, ERLError> fastly::erl::PenaltyBox::add(std::string_view entry, std::chrono::minutes ttl)

Add entry to a the penaltybox for the duration of ttl. Valid ttl span is 1m to 1h.

Parameters

entry: std::string_view
ttl: std::chrono::minutes

Returns

tl::expected<void, ERLError>
tl::expected<bool, ERLError> fastly::erl::PenaltyBox::has(std::string_view entry) const

Check if entry is in the penaltybox.

Parameters

entry: std::string_view

Returns

tl::expected<bool, ERLError>
std::string_view fastly::erl::PenaltyBox::name() const

Returns

std::string_view