---
title: PenaltyBox
summary: PenaltyBox is a type that allows entries to be penalized for a given number of minutes in the future.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/erl/struct.PenaltyBox/
---

**Kind:** Struct  
**Module:** [erl](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/erl/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/erl/erl.go#L157

```go
type PenaltyBox struct {
	// contains filtered or unexported fields
}
```

PenaltyBox is a type that allows entries to be penalized for a given
number of minutes in the future.

## Methods

### Add

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/erl/erl.go#L174

```go
func (pb *PenaltyBox) Add(entry string, ttl time.Duration) error
```

Add adds an entry to the penalty box for the given time-to-live (TTL)
duration.  The minimum value is 1 minute and the maximum is 60
minutes.  If an entry is already in the penalty box, its TTL is
replaced with the new value.  Entries are automatically evicted from
the penalty box when the TTL expires.

**Parameters**

- `entry`: `string`
- `ttl`: `time.Duration`

**Returns**

`error`

### Has

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/erl/erl.go#L179

```go
func (pb *PenaltyBox) Has(entry string) (bool, error)
```

Has returns true if the given entry is currently in the penalty box.

**Parameters**

- `entry`: `string`

**Returns**

`(bool, error)`
