---
title: SQL cache functions
description: Retrieve cached data from InfluxDB 3 Cloud caches.
url: https://docs.influxdata.com/influxdb3/cloud/reference/sql/functions/cache/
estimated_tokens: 277
product: InfluxDB 3 Cloud
version: cloud
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/cloud/reference/sql/functions/cache/
date: '2026-11-04T16:05:15-06:00'
lastmod: '2026-11-04T16:05:15-06:00'
---

The InfluxDB 3 Cloud SQL implementation supports the following functions
that return data from InfluxDB 3 Cloud caches.

## distinct\_cache

Returns data from an InfluxDB 3 Cloud distinct value cache.

```sql
distinct_cache(table_name, cache_name)
```

### Arguments

* **table\_name**: Name of the table associated with the distinct value cache*(formatted as a string literal)*.
* **cache\_name**: Name of the distinct value cache to query*(formatted as a string literal)*.

[](#view-distinct_cache-query-example)

View `distinct_cache` query example

```sql
SELECT * FROM distinct_cache('example_table', 'exampleCacheName')
```

## last\_cache

Returns data from an InfluxDB 3 Cloud last value cache.

```sql
last_cache(table_name, cache_name)
```

### Arguments

* **table\_name**: Name of the table associated with the last value cache*(formatted as a string literal)*.
* **cache\_name**: Name of the last value cache to query*(formatted as a string literal)*.

[](#view-last_cache-query-example)

View `last_cache` query example

```sql
SELECT * FROM last_cache('example_table', 'exampleCacheName')
```
