---
description:
  Improve browser storage with LocalForage caching mechanism in GraphQL Mesh. Install
  `@graphql-mesh/cache-localforage` and configure your `.meshrc.yaml`. Recommended for browser
  environments, see examples in our docs.
---

# LocalForage

LocalForage is a library that improves the existing storage mechanism in the browser by using
`IndexedDB`, `WebSQL` and `localStorage`, [see more](https://github.com/localForage/localForage).

This caching mechanism is only recommended for the browser environments,
[see the example](https://github.com/ardatan/graphql-mesh/blob/master/examples/openapi-react-weatherbit/src/mesh/useMeshSdk.ts#L10).

To get started with this caching strategy, install it:

```sh npm2yarn
npm i @graphql-mesh/cache-localforage
```

## How to use?

```yaml filename=".meshrc.yaml"
cache:
  localforage:
    driver: [WEBSQL, INDEXEDDB, LOCALSTORAGE] # LocalForage will try these methods in order and get the first compatible option
```

## Config API Reference

import API from '../../../generated-markdown/LocalforageConfig.generated.md'

<API />
