# KeyedFrequencyCap

Artifact: [androidx.privacysandbox.ads:ads-adservices](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap.kt+class:androidx.privacysandbox.ads.adservices.common.KeyedFrequencyCap) Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

*** ** * ** ***


```
@ExperimentalFeatures.Ext8OptIn
public final class KeyedFrequencyCap
```

<br />

*** ** * ** ***

A frequency cap for a specific ad counter key.

Frequency caps define the maximum rate an event can occur within a given time interval. If the frequency cap is exceeded, the associated ad will be filtered out of ad selection.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#KeyedFrequencyCap(kotlin.Int,kotlin.Int,java.time.Duration)( int adCounterKey, int maxCount, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html interval )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap` objects contain the same information. |
| `final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#getAdCounterKey()()` The ad counter key that the frequency cap is applied to |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#getInterval()()` The interval, as a `https://developer.android.com/reference/java/time/Duration.html` over which the frequency cap is calculated |
| `final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#getMaxCount()()` The maximum count of event occurrences allowed within a given time interval |
| `int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#hashCode()()` Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap` object's data. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#toString()()` Overrides the toString method. |

## Public constructors

### KeyedFrequencyCap

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public KeyedFrequencyCap(
    int adCounterKey,
    int maxCount,
    @NonNull Duration interval
)
```

| Parameters |
|---|---|
| `int adCounterKey` | The ad counter key that the frequency cap is applied to |
| `int maxCount` | The maximum count of event occurrences allowed within a given time interval |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html interval` | The interval, as a `https://developer.android.com/reference/java/time/Duration.html` over which the frequency cap is calculated |

## Public methods

### equals

```
public boolean equals(Object other)
```

Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap` objects contain the same information.

### getAdCounterKey

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public final int getAdCounterKey()
```

The ad counter key that the frequency cap is applied to

### getInterval

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public final @NonNull Duration getInterval()
```

The interval, as a `https://developer.android.com/reference/java/time/Duration.html` over which the frequency cap is calculated

### getMaxCount

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public final int getMaxCount()
```

The maximum count of event occurrences allowed within a given time interval

### hashCode

```
public int hashCode()
```

Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap` object's data.

### toString

```
public @NonNull String toString()
```

Overrides the toString method.