# KeyedFrequencyCap

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap "View this page in Java")

<br />

```
@ExperimentalFeatures.Ext8OptIn
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                                                                                                                                                                                                                              |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [KeyedFrequencyCap](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#KeyedFrequencyCap(kotlin.Int,kotlin.Int,java.time.Duration))`(adCounterKey: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, maxCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, interval: `[Duration](https://developer.android.com/reference/java/time/Duration.html)`)` |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Checks whether two[KeyedFrequencyCap](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap)objects contain the same information. |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#hashCode())`()` Returns the hash of the[KeyedFrequencyCap](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap)object's data.                                                                                                              |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#toString())`()` Overrides the toString method.                                                                                                                                                                                                                                                        |

|                            ### Public properties                            |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [adCounterKey](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#adCounterKey()) The ad counter key that the frequency cap is applied to                                                                         |
| [Duration](https://developer.android.com/reference/java/time/Duration.html) | [interval](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#interval()) The interval, as a[Duration](https://developer.android.com/reference/java/time/Duration.html)over which the frequency cap is calculated |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [maxCount](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap#maxCount()) The maximum count of event occurrences allowed within a given time interval                                                             |

## Public constructors

### KeyedFrequencyCap

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

```
KeyedFrequencyCap(adCounterKey: Int, maxCount: Int, interval: Duration)
```  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `adCounterKey: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The ad counter key that the frequency cap is applied to                                                                                 |
| `maxCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The maximum count of event occurrences allowed within a given time interval                                                             |
| `interval: `[Duration](https://developer.android.com/reference/java/time/Duration.html)     | The interval, as a[Duration](https://developer.android.com/reference/java/time/Duration.html)over which the frequency cap is calculated |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

Checks whether two[KeyedFrequencyCap](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap)objects contain the same information.  

### hashCode

```
open fun hashCode(): Int
```

Returns the hash of the[KeyedFrequencyCap](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/KeyedFrequencyCap)object's data.  

### toString

```
open fun toString(): String
```

Overrides the toString method.  

## Public properties

### adCounterKey

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

```
val adCounterKey: Int
```

The ad counter key that the frequency cap is applied to  

### interval

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

```
val interval: Duration
```

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

### maxCount

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

```
val maxCount: Int
```

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