---
title: isCached
description: "Catalog.isCached method in PySpark: Returns true if the table is currently cached in-memory."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/catalog/isCached
---

# isCached

Returns true if the table is currently cached in-memory.

## Syntax

```
isCached(tableName: str)
```

## Parameters

| Parameter   | Type | Description                                                   |
| ----------- | ---- | ------------------------------------------------------------- |
| `tableName` | str  | Name of the table to get. Can be qualified with catalog name. |

## Returns

`bool`

## Examples

> [!NOTE]
>
> Databricks recommends moving away from `spark.catalog.cacheTable` as it is not compatible with Databricks serverless compute architecture. Remove explicit caching calls (serverless auto-tunes; materialize to Delta if expensive) instead.

```python
_ = spark.sql("DROP TABLE IF EXISTS tbl1")
_ = spark.sql("CREATE TABLE tbl1 (name STRING, age INT) USING parquet")
spark.catalog.cacheTable("tbl1")
spark.catalog.isCached("tbl1")
# True

# Throw an analysis exception when the table does not exist.
spark.catalog.isCached("not_existing_table")
# Traceback (most recent call last):
#     ...
# AnalysisException: ...

# Using the fully qualified name for the table.
spark.catalog.isCached("spark_catalog.default.tbl1")
# True
spark.catalog.uncacheTable("tbl1")
_ = spark.sql("DROP TABLE tbl1")
```
