---
url: /api/symbols/workbox-swkit/cacheable-response/cacheableresponse.md
---

# CacheableResponse

Class @vite-pwa/workbox-swkit/cacheable-response

This class allows you to set up rules determining what
status codes and/or headers need to be present in order for a
[`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
to be considered cacheable.

## Constructor

```ts
new CacheableResponse(config: CacheableResponseOptions)
```

To construct a new CacheableResponse instance you must provide at least
one of the `config` properties.

If both `statuses` and `headers` are specified, then both conditions must
be met for the `Response` to be considered cacheable.

## Methods

### isResponseCacheable()

```ts
isResponseCacheable(response: Response): boolean
```

Checks a response to see whether it's cacheable or not, based on this
object's configuration.

**Parameters**

* `response` – The response whose cacheability is being
  checked.

**Returns:** `true` if the `Response` is cacheable, and `false`
otherwise.
