---
title: CacheState
summary: The status of this lookup (and potential transaction).
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/class.CacheState/
---

**Kind:** Class  
**Module:** [cache](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/cache/)  
**Package:** @fastly/js-compute 4.0.1  
**Since:** 3.9.0  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L345

The status of this lookup (and potential transaction).

## Methods

### found

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L351

```javascript
found(): boolean
```

Returns `true` if a cached item was located.

Even if a cached item is found, the cached item might be stale and require updating. Use `mustInsertOrUpdate()` to determine whether this transaction client is expected to update the cached item.

**Returns**

`boolean`

### mustInsertOrUpdate

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L367

```javascript
mustInsertOrUpdate(): boolean
```

Returns `true` if a fresh cache item was not found, and this transaction client is expected to insert a new item or update a stale item.

**Returns**

`boolean`

### stale

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L363

```javascript
stale(): boolean
```

Returns `true` if the cached item is stale.

A cached item is stale if its age is greater than its `maxAge` period.

**Returns**

`boolean`

### usable

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/cache.d.ts#L357

```javascript
usable(): boolean
```

Returns `true` if the cached item is usable.

A cached item is usable if its age is less than the sum of the `maxAge` and `staleWhileRevalidate` periods.

**Returns**

`boolean`
