A lightweight cache library for Apollo Client (v0.4.3, updated ~2024) providing two simplified cache implementations: SimpleDocumentCache (a fast per-query document cache) and OptimizedNormalizedCache (a normalized cache optimized for read/write performance, often faster than Apollo's InMemoryCache). Ships TypeScript types, requires Node >=20, and has peer dependencies on @apollo/client ^3.13.8 || ^4 and graphql ^15 || ^16. Differentiators include explicit control over cache keys, optimized reads, and a simpler API surface compared to Apollo's built-in caches.
npm install apollo-simple-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an Apollo Client with SimpleDocumentCache and executes a simple query. Note the document must have an operation name.
Replace import { ... } from 'apollo-simple-cache' with import { ... } from 'apollo-simple-cache/v4'.Use OptimizedNormalizedCache or InMemoryCache if you need optimistic UI.
Either add operation names to all queries, or provide a custom getCacheKey callback.
Use import syntax and ensure Node version >=20.
Change require() to import or set type: 'module' in package.json.
Ensure you are using apollo-simple-cache v0.4.0 or later and have installed @apollo/client v4.