relay-cache-manager

0.2.1 • Public • Published

relay-cache-manager

A CacheManager implementation for local data caching in Relay

Overview

Relay defines the CacheManager interface which lets you write and read records to a local cache. Relay will check the cache first when identifying what data it has/needs; by implementing a CacheManager you can render locally cached data quickly while Relay queries your API and updates the data when the response comes in.

Install

$ npm install --save relay-cache-manager

Usage

Until RelayEnvironment exposes injectCacheManager you have to inject it directly from the RelayStoreData instance used by your store. You can access that via the getStoreData() method on your RelayEnvironment instance. If you're using Relay.Store you can just do:

import CacheManager from 'relay-cache-manager';
const cacheManager = new CacheManager();
Relay.Store.getStoreData().injectCacheManager(cacheManager);

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i relay-cache-manager

    Weekly Downloads

    0

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • aweary