Apollo Link and Express middleware that caches GraphQL queries using a @cache directive. Version 10.0.1 supports Apollo Client 3, Express 4, and any GraphQL >=14. It provides an in-memory cache (Map-based) and a Redis backend. Key differentiator: server-side caching for SSR to reduce initial render time, with a proxy that strips the directive and serves cached responses locally. It uses http-proxy-middleware to forward non-cached queries. Release cadence is semantic-release based, with frequent minor updates.
npm install apollo-proxy-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up Express middleware with InMemoryCache that caches GraphQL queries containing @cache directive and proxies others.
Upgrade Node to >=16 or use an older version of the package.
Replace usage of apollo-utilities with @apollo/client equivalents.
Ensure app.use(bodyParser.json()) precedes app.use('/graphql', directiveMiddleware).Your server schema should not enforce unknown directives; the directive is only used client-side.
npm install apollo-utilities
Use import statements instead of require().
Add app.use(bodyParser.json()) before the proxy middleware.