Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

An implementation of the RelayCacheManager for local data caching in Relay

License

Notifications You must be signed in to change notification settings

LimbixHealth/relay-cache-manager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

In a browser environment:

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

With a custom cache storage provider (in React Native using AsyncStorage for example):

import CacheManager from 'relay-cache-manager';
const cacheManager = new CacheManager({
  cacheStorageProvider: new AsyncStorageCacheStorageProvider(),
});
Relay.Store.injectCacheManager(cacheManager);

About

An implementation of the RelayCacheManager for local data caching in Relay

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.8%
  • HTML 3.2%