> For the complete documentation index, see [llms.txt](https://sserra.gitbook.io/livebox/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sserra.gitbook.io/livebox/how-to-use-it/using-age-validator.md).

# Using Age Validator

A recurring use case is to save the data in cache only for a period of time.  To address this issue Livebox comes with a built-in AgeValidator that invalidates data after a certain amount of time has passed.

```java
// 2 minutes TTL(time to live)
Validator<UsersRes> ageValidator = AgeValidator.create(TimeUnit.MINUTES.toMillis(2));

// Add to data source
.addSource(Sources.DISK_PERSISTENT, persistentDiskValidator)

```

In the above example the data is only valid for 2 minutes.
