# CacheSettings

# CacheSettings


```
class CacheSettings
```

<br />

*** ** * ** ***

The local caching settings used by a `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/FirebaseDataConnect` object, as specified in its `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/DataConnectSettings`.

## Summary

| ### Nested types |
|---|
| `enum https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.Storage : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html` The types of cache storage supported by `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/FirebaseDataConnect` in its `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings` setting. |

| ### Public constructors |
|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#CacheSettings(com.google.firebase.dataconnect.CacheSettings.Storage,kotlin.time.Duration)(storage: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.Storage, maxAge: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html)` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#equals(kotlin.Any)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Compares this object with another object for equality. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#hashCode()()` Calculates and returns the hash code for this object. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#toString()()` Returns a string representation of this object, useful for debugging. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#maxAge()` The maximum age of cached query results to use before considering them to be "stale". |
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.Storage` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#storage()` The type of storage to use to store the cache data. |

| ### Extension functions |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#(com.google.firebase.dataconnect.CacheSettings).copy(com.google.firebase.dataconnect.CacheSettings.Storage,kotlin.time.Duration)(storage: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.Storage, maxAge: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html)` Creates and returns a new `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings` object with the given property values. |

## Public constructors

### CacheSettings

```
CacheSettings(
    storage: CacheSettings.Storage = Storage.PERSISTENT,
    maxAge: Duration = Duration.ZERO
)
```

| Parameters |
|---|---|
| `storage: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings.Storage = Storage.PERSISTENT` | The value to set for the `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings#storage()` property. |
| `maxAge: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html = Duration.ZERO` | The maximum age of cached query results to use before considering them to be "stale". |

## Public functions

### equals

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

Compares this object with another object for equality.

| Parameters |
|---|---|
| `other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?` | The object to compare to this for equality. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | true if, and only if, the other object is an instance of `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings` whose public properties compare equal using the `==` operator to the corresponding properties of this object. |

### hashCode

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

Calculates and returns the hash code for this object.

The hash code is *not* guaranteed to be stable across application restarts.

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the hash code for this object, that incorporates the values of this object's public properties. |

### toString

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

Returns a string representation of this object, useful for debugging.

The string representation is *not* guaranteed to be stable and may change without notice at any time. Therefore, the only recommended usage of the returned string is debugging and/or logging. Namely, parsing the returned string or storing the returned string in non-volatile storage should generally be avoided in order to be robust in case that the string representation changes.

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | a string representation of this object, which includes the class name and the values of all public properties. |

## Public properties

### maxAge

```
val maxAge: Duration
```

The maximum age of cached query results to use before considering them to be "stale".

### storage

```
val storage: CacheSettings.Storage
```

The type of storage to use to store the cache data.

## Extension functions

### copy

```
fun CacheSettings.copy(
    storage: CacheSettings.Storage = this.storage,
    maxAge: Duration = this.maxAge
): CacheSettings
```

Creates and returns a new `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/dataconnect/CacheSettings` object with the given property values.