0.2.1 • Published 9 years ago
relay-cache-manager v0.2.1
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-managerUsage
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);