Type policies define how types are stored and retrieved from cache. Configure key fields, field behaviors. Features: custom merge functions, field read/write functions. Controls cache behavior per GraphQL type.
Field policies customize individual field behavior. Define read/write functions, merge strategies. Features: computed fields, custom caching logic. Handles complex field requirements.
Cache initialization sets up initial cache state. Configure type policies, initial data. Features: preloaded state, type configuration. Essential for proper cache setup and behavior.
Real-time updates through subscriptions, cache updates. Implement automatic merging, optimistic UI. Features: subscription integration, cache consistency. Maintains real-time data state.
Cache normalization flattens nested data using unique identifiers. Implements automatic ID generation, reference handling. Features: customizable key fields, type policies. Essential for consistent data representation and updates.
Cache invalidation through evict, modify methods. Implement selective updates, refetching. Features: field-level invalidation, type-level eviction. Ensures data freshness.
Cache debugging through Apollo DevTools, logging. Inspect cache state, watch updates. Features: cache explorer, update tracking. Essential for development and troubleshooting.
Pagination through field policies, merge functions. Implement cursor-based/offset pagination. Features: automatic merging, custom merge strategies. Manages paginated data in cache.
Cache policies control data reading/writing. Types: cache-first, network-only, etc. Features: customizable per query, default settings. Balances performance and data freshness.
Cache extraction retrieves current cache state. Used for SSR, persistence. Features: serialization, state transfer. Important for server rendering, cache backup.
Custom resolvers handle field computation, data transformation. Implement local-only fields, computed values. Features: field-level resolution, cache integration. Extends cache capabilities.
Local state through reactive variables, local-only fields. Implement client-side resolvers, type extensions. Features: @client directive, local mutations. Manages UI state alongside server data.
Cache redirects customize cache data access. Define field reading behavior, data relationships. Features: custom resolvers, field policies. Handles complex data relationships and queries.
Optimistic responses update UI before server response. Implement temporary cache updates, rollback handling. Features: immediate feedback, error recovery. Improves perceived performance.
Reactive variables manage local state. Independent of GraphQL operations. Features: direct reads/writes, automatic updates. Simplifies local state management.