0.1.2 • Published 7 years ago
apollo-cache-redux v0.1.2
apollo-cache-redux is a cache implementation backed by Redux for Apollo Client 2.0.
It heavily reuses cache normalization code from apollo-cache-inmemory.
Works with Redux 3.x and 4.x .
Installation
npm install apollo-cache-redux --saveAfter installing the package:
import { ReduxCache, apolloReducer } from 'apollo-cache-redux';
import { createStore, combineReducers } from 'redux';
import { HttpLink } from 'apollo-link-http';
import ApolloClient from 'apollo-client';
const store = createStore(
combineReducers({
apollo: apolloReducer
...otherReducers
})
);
const cache = new ReduxCache({ store });
const client = new ApolloClient({
link: new HttpLink(),
cache
});The following options are accepted for ReduxCache:
store. An existing Redux store. If you don't have one, please create it as per the example above.reduxRootSelector(optional). Customises the reducer name for the cache (default:apollo).- Other options accepted by
InMemoryCache, to customise the underlyingInMemoryCache(e.g.fragmentMatcher).
Tests
Apart from the unit tests in this repo, this cache implementation was tested with the apollo-client and react-apollo end-to-end tests.
Until there's a better way to bring them to this repo, they will reside in their own branches of these projects:
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
8 years ago
0.1.0-alpha.8
8 years ago
0.1.0-alpha.7
8 years ago
0.1.0-alpha.6
8 years ago
0.1.0-alpha.5
8 years ago
0.1.0-alpha.4
8 years ago
0.1.0-alpha.3
8 years ago
0.1.0-alpha.2
8 years ago
0.1.0-alpha.1
8 years ago