---
title: SQL cache functions
description: Retrieve cached data from InfluxDB 3 Enterprise caches.
url: https://docs.influxdata.com/influxdb3/enterprise/reference/sql/functions/cache/
estimated_tokens: 912
product: InfluxDB 3 Enterprise
version: enterprise
---

# SQL cache functions

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

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

## distinct\_cache

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