---
title: PenaltyBox
summary: 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.
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/erl/class.PenaltyBox/
---

**Kind:** Class  
**Module:** [erl](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/erl/)  
**Package:** compute-sdk-cpp 0.7.0  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/erl.h#L25

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

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/erl.h#L27

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

**Parameters**

- `name`: `std::string`

## Methods

### add

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/erl.h#L30

```cpp
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>`

### has

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/erl.h#L33

```cpp
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>`

### name

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/erl.h#L34

```cpp
std::string_view fastly::erl::PenaltyBox::name() const
```

**Returns**

`std::string_view`
