On this page

LocalForage

GraphQL Mesh v0 documentation (superseded by v1): 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 is a library that improves the existing storage mechanism in the browser by using IndexedDB, WebSQL and localStorage, see more.

This caching mechanism is only recommended for the browser environments, see the example.

To get started with this caching strategy, install it:

npm i @graphql-mesh/cache-localforage

How to use?

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

Config API Reference

  • driver (type: Array of String (WEBSQL | INDEXEDDB | LOCALSTORAGE), required)
  • name (type: String)
  • version (type: Float)
  • size (type: Int)
  • storeName (type: String)
  • description (type: String)