Graphile Cache provides a simple, performance-oriented LRU cache primarily designed for use with PostGraphile v5 and Graphile Worker. It automatically integrates with PostGraphile's pool lifecycle to clean up cache entries when database connections are released, preventing stale data and memory leaks. Current stable version 3.13.0 is maintained and released regularly as part of the Constructive monorepo. Key differentiators: automatic pool cleanup, focused scope for Graphile ecosystem, and minimal overhead compared to general-purpose caches.
npm install graphile-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of getting a cache instance, setting/getting values with TTL, and clearing the cache.
Ensure you are using the cache as part of a PostGraphile setup, or manually manage cleanup if used standalone.
Always use string keys explicitly.
Monitor cache size or configure a larger max size if needed.
import { getCache } from 'graphile-cache'Use getCache() without arguments for the default cache, or create a named cache with getCache('myCache').No dependency data recorded yet.