Skip to content

An implementation of the RelayCacheManager for local data caching in Relay

License

Notifications You must be signed in to change notification settings

HomeServicesOfAmerica/relay-cache-manager

Repository files navigation

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);

About

An implementation of the RelayCacheManager for local data caching in Relay

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •