---
title: SQL cache functions
description: Retrieve cached data from InfluxDB 3 Core caches.
url: https://docs.influxdata.com/influxdb3/core/reference/sql/functions/cache/
estimated_tokens: 293
product: InfluxDB 3 Core
version: core
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/core/reference/sql/functions/cache/
date: '2025-09-05T08:26:38-06:00'
lastmod: '2025-09-05T08:26:38-06:00'
---

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

* [distinct\_cache](#distinct_cache)
* [last\_cache](#last_cache)

## distinct\_cache

Returns data from an InfluxDB 3 Core 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 Core 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')
```
