In-memory caching implementation for graphql-hooks, currently at version 3.2.0. The package provides a simple LRU-based cache with configurable size and TTL, designed for use with the graphql-hooks React GraphQL client. It supports server-side rendering by allowing rehydration of cache state via initialState. Key differentiators are its minimal API surface and direct integration with graphql-hooks. The library is actively maintained as part of the nearform/graphql-hooks ecosystem.
npm install graphql-hooks-memcacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a GraphQL client with an in-memory cache using graphql-hooks-memcache, including optional size and ttl options.
Use default import: import memCache from 'graphql-hooks-memcache'
Use cache.getInitialState() on server and hydrate on client with graphql-hooks' useHydrateCache hook.
Serialize keys to string: cache.set(JSON.stringify(key), value)
Use manual cache.delete(key) for specific queries or cache.clear() to reset all.
Use default import: import memCache from 'graphql-hooks-memcache'
Run npm install graphql-hooks-memcache. Ensure tsconfig.json includes node_modules types.
Check for undefined: const result = cache.get(key) ?? null
No dependency data recorded yet.