# Document.TtlMillis

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/annotation/Document.java+class:androidx.appsearch.annotation.Document.TtlMillis) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***

<br />

```
@Documented
@Retention(value = RetentionPolicy.CLASS)
@Target(value = [ElementType.FIELD, ElementType.METHOD])
public annotation Document.TtlMillis
```

<br />

*** ** * ** ***

Marks a member field of a document as the document's time-to-live (TTL).

The document will be automatically deleted `https://developer.android.com/reference/androidx/appsearch/annotation/Document.TtlMillis` milliseconds after `https://developer.android.com/reference/androidx/appsearch/annotation/Document.CreationTimestampMillis`.

This field is not required. If not present, not set, or set to `0`, the document will never expire or be auto-deleted until the app is uninstalled or `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#removeAsync(androidx.appsearch.app.RemoveByDocumentIdRequest)` is called.

If present, the field must be of type `long` or `https://developer.android.com/reference/java/lang/Long.html`.

See the class description of `https://developer.android.com/reference/androidx/appsearch/annotation/Document` for other requirements (i.e. if present it must be visible, or have a visible getter and setter, or be exposed through a visible constructor).