# NoVarySearchHeader

# NoVarySearchHeader

Artifact:[androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit)  
[View Source](https://cs.android.com/search?q=file:androidx/webkit/NoVarySearchHeader.java+class:androidx.webkit.NoVarySearchHeader)  
Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/webkit/NoVarySearchHeader "View this page in Java")

<br />

```
@Profile.ExperimentalUrlPrefetch
class NoVarySearchHeader
```

<br />

*** ** * ** ***

The No-Vary-Search header specifies a set of rules that define how a URL's query parameters will affect cache matching. These rules dictate whether the same URL with different URL parameters should be saved as separate browser cache entries.

See[Doc here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/No-Vary-Search)to learn more about No-Vary-Search.

## Summary

|                                                 ### Public functions                                                  |
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[NoVarySearchHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader) | `@`[Profile.ExperimentalUrlPrefetch](https://developer.android.com/reference/kotlin/androidx/webkit/Profile.ExperimentalUrlPrefetch) [alwaysVaryHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#alwaysVaryHeader())`()` Returns No-Vary-Search header that considers all differences in query parameters (i.e. presence and ordering) between otherwise identical URLs in cache matching.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `java-static `[NoVarySearchHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader) | `@`[Profile.ExperimentalUrlPrefetch](https://developer.android.com/reference/kotlin/androidx/webkit/Profile.ExperimentalUrlPrefetch) [neverVaryExcept](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#neverVaryExcept(boolean,java.util.List<java.lang.String>))`(` ` varyOnOrdering: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` consideredQueryParameters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` `)` Returns No-Vary-Search header that doesn't consider differences in in query parameters present between otherwise identical URLs in cache matching with the exception of the ones provided in[consideredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#consideredQueryParameters()). |
| `java-static `[NoVarySearchHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader) | `@`[Profile.ExperimentalUrlPrefetch](https://developer.android.com/reference/kotlin/androidx/webkit/Profile.ExperimentalUrlPrefetch) [neverVaryHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#neverVaryHeader())`()` Returns No-Vary-Search header that doesn't consider any differences in query parameters (i.e. presence or ordering) between otherwise identical URLs in cache matching.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `java-static `[NoVarySearchHeader](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader) | `@`[Profile.ExperimentalUrlPrefetch](https://developer.android.com/reference/kotlin/androidx/webkit/Profile.ExperimentalUrlPrefetch) [varyExcept](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#varyExcept(boolean,java.util.List<java.lang.String>))`(` ` varyOnOrdering: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` ignoredQueryParameters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` `)` Returns No-Vary-Search header that considers differences in in query parameters present between otherwise identical URLs in cache matching with the exception of the ones provided in[ignoredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoredQueryParameters()).                           |

|                                                                                                                                    ### Public properties                                                                                                                                    |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | [consideredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#consideredQueryParameters()) A[List](https://developer.android.com/reference/java/util/List.html)of parameters that if present, will cause otherwise identical URLs to be cached as separate entries. |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [ignoreDifferencesInParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoreDifferencesInParameters()) A`true`to indicate the differences in parameters present between otherwise identical URLs will not cause them to be cached as separate entries.                  |
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | [ignoredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoredQueryParameters()) A[List](https://developer.android.com/reference/java/util/List.html)of parameters that if present, will not cause otherwise identical URLs to be cached as separate entries.   |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [varyOnKeyOrder](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#varyOnKeyOrder()) If`true`this indicates that differences in the order of parameters between otherwise identical URLs will cause them to be cached as separate entries.                                          |

## Public functions

### alwaysVaryHeader

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
@Profile.ExperimentalUrlPrefetch
java-static fun alwaysVaryHeader(): NoVarySearchHeader
```

Returns No-Vary-Search header that considers all differences in query parameters (i.e. presence and ordering) between otherwise identical URLs in cache matching.  

### neverVaryExcept

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
@Profile.ExperimentalUrlPrefetch
java-static fun neverVaryExcept(
    varyOnOrdering: Boolean,
    consideredQueryParameters: (Mutable)List<String!>
): NoVarySearchHeader
```

Returns No-Vary-Search header that doesn't consider differences in in query parameters present between otherwise identical URLs in cache matching with the exception of the ones provided in[consideredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#consideredQueryParameters()).  

|                                                                                                                                                       Parameters                                                                                                                                                       |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| `varyOnOrdering: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                  | true if the ordering of query parameters should be considered in cache matching, false otherwise. |
| `consideredQueryParameters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | the query parameters to consider in cache matching.                                               |

### neverVaryHeader

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
@Profile.ExperimentalUrlPrefetch
java-static fun neverVaryHeader(): NoVarySearchHeader
```

Returns No-Vary-Search header that doesn't consider any differences in query parameters (i.e. presence or ordering) between otherwise identical URLs in cache matching.  

### varyExcept

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
@Profile.ExperimentalUrlPrefetch
java-static fun varyExcept(
    varyOnOrdering: Boolean,
    ignoredQueryParameters: (Mutable)List<String!>
): NoVarySearchHeader
```

Returns No-Vary-Search header that considers differences in in query parameters present between otherwise identical URLs in cache matching with the exception of the ones provided in[ignoredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoredQueryParameters()).  

|                                                                                                                                                     Parameters                                                                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| `varyOnOrdering: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                               | true if the ordering of query parameters should be considered in cache matching, false otherwise. |
| `ignoredQueryParameters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | the query parameters to ignore in cache matching.                                                 |

## Public properties

### consideredQueryParameters

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
val consideredQueryParameters: (Mutable)List<String!>
```

A[List](https://developer.android.com/reference/java/util/List.html)of parameters that if present, will cause otherwise identical URLs to be cached as separate entries. Any parameters present in the URLs that are not included in this list will not affect cache matching.

This list is irrelevant and not used if[ignoreDifferencesInParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoreDifferencesInParameters())is`false`.  

### ignoreDifferencesInParameters

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
val ignoreDifferencesInParameters: Boolean
```

A`true`to indicate the differences in parameters present between otherwise identical URLs will not cause them to be cached as separate entries.`false`otherwise.  

### ignoredQueryParameters

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
val ignoredQueryParameters: (Mutable)List<String!>
```

A[List](https://developer.android.com/reference/java/util/List.html)of parameters that if present, will not cause otherwise identical URLs to be cached as separate entries. Any parameters present in the URLs that are not included in this list will affect cache matching.

This list is irrelevant and not used if[ignoreDifferencesInParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoreDifferencesInParameters())is`true`.  

### varyOnKeyOrder

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)  

```
val varyOnKeyOrder: Boolean
```

If`true`this indicates that differences in the order of parameters between otherwise identical URLs will cause them to be cached as separate entries.

However, differences in the parameters present will cause them to be cached separately regardless of this flag's value.

To ignore any differences in parameters present for caching see[ignoreDifferencesInParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoreDifferencesInParameters())and[ignoredQueryParameters](https://developer.android.com/reference/kotlin/androidx/webkit/NoVarySearchHeader#ignoredQueryParameters()).`false`otherwise.